Old thread: What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
pastebin.com
youtube.com
github.com
github.com
en.wikipedia.org
docs.microsoft.com
twitter.com
static int a;
printf(a);
Thread thread = new Thread();
snib snibedi snab :DDDDD
auto car = new Car();
Dart is my favorite language.
std::unique_ptr tread{std::make_unique()};
do not use auto, it makes reading the code harder most of the times
>want to use java 11 for that sweet sweet type inference feature
>most libraries don't support 11
>do not use auto
but a car is an auto?
auto car = new();
// future compiler infers what class you want from
choice of variable name
No, a car is a bil
user, reccomend me some best PHP learning resources for beginners.
from /wdg/
made some progress on the game. our sprites are animated now
auto car{...};
auto mobile
It would be very painful
...
Sensible chuckle.jpg
Lisp is the most powerful programming language.
How do I cope with Mika fucking a rando?
check the meds and adjust the dosage
Sup guys, brainlet here. I am a newb at programming, however, I want to write an emulator(CHIP-8 or 8080) in C. However I realized that I am completely clueless from the little research that I have done. I have found out that you need to be familiar with assembly, know how a CPU works, know what OPCODES are, etc. So there's a lot of required knowledge, so could any of you kind citizens who have had experience with emulators in the past, walk me through on resources I should read to be able to write an emulator? I will greatly appreciate it.
>, I want to write an emulator(CHIP-8 or 8080)
why is that that everyone has this idea? must be some college assignment for sure
look for the multigesture articles
Clearly didn't watch SEL. How does Lain cope with her sister being so promiscuous at such a young age?
chip-8 is the hello world of emulator dev
In my case, I just wanted a more involved project so that I could git gud at programming in general. Emulators looked fun, so I wanted to give it a shot.
Thanks man, I will give it a look.
>What are you working on, Jow Forums?
Nothing too serious. Playing around with xcb. I found out that I _can_ get mouse motion events for the root window and for all children, and I need to traverse the tree and hook each window. It's a neat problem to solve.
You might find this interesting: youtube.com
This thread is about programming, not being a tranny.
Thanks senpai, I will watch it completely.
Jow Forums is an anime website.
Fuck off Hiroshim00t
>heh I'm not a newfag
>sprite
>no sprite sheet
retard
How important is job experience vs being able to solve leetcode type questions during a job hunt? I was able to land an internship this summer (possibly part time during my last school year) but I was curious if that will off set obnoxious technical interviews in any way in the future.
i feel like most places won't ask leetcode hard because some of them are very difficult. most the easy and medium ones a bruteforce solution can be found pretty easily which i'm sure is all they really care about if someone had a super optimized solution it would seem as if they already seen that question and the trick to solving it.
Anyone know CL? Why is this a CONS instead of a SYMBOL?
CL-USER> (type-of ''foo)
CONS
How does QUOTE work?
>no lain
shit op
fuck C++ and C++ wannabies.
this but sexually
how do spritesheets work? I never understood them.
>snib snab imma trab :D
how are those things fuckable (sexually)?
metaphorically
the key to it is understanding that reality is just metaphors, so fucking something sexually metaphorically is the same is fucking something sexually
mind if i enterigate the semiotics of genderitics with you my fellow intellechual?
>Addicted to the writablilty, type coercion, and built in helper functions of langs like JS and Python
No regrets
>>mentally ill
>no regrets
From my understanding you iterate over sections of the sheet.
but how do you do that with code?
example?
That's a nice spritesheet.
You load the sprite sheet into a texture then use multiplication to determine which part to draw.
github.com
I just grabbed it from google, but yeah it's neat.
this Let's say each frame is 64 pixels (8x8), at 12 frames you have a 780 pixel sheet. You can create a 8x8 buffer and iterate from wherever.
quote returns its argument unevaluated.
' is a synonym for (quote).
expanding your expression: (type-of ''foo) => (type-of (quote (quote foo))) => (type-of (quote foo))
keep in mind the inner quote is not evaluated because of the outer one. thus you're left with a list (cons).
Thinking about reverse image search.
Thought a good approach might be to partition the image into a set number of blocks and then just take the mean RGB value of each block and stick that into an array to be searched against. This approach would be pretty robust against blurring and light compression artifacts but then I realized that the most common image distortions you would run into on the internet are color filters which would kill this.
Gonna sleep on it.
but that caps all of your images to a certain hardcoded resolution
why not save texture coordinates of subtextures somewhere in the image itself, like in the alpha channel or something
int main()
{
vector A = {0,1,2,2,3,0,4,2};
int x = 0;
int target = 2;
for (int j = 0; j < A.size(); ++j)
{
if (A[j] == target)
{
while (x < A.size() & A[x] == target)
{
x += 1;
}
int key = A[j];
A[j] = A[x];
A[x] = key;
}else
x += 1;
}
for (int b = 0; b
So I am learning C#.
how do I read this?
What does the first line mean?
Usually the way it's done is you have a sprite sheet per animated sprite, this you can just divide the width and height of the texture by the number of sprite on each axis to get the size and index of each sprite.
Another way I find better is to build a texture atlas at runtime from lots of small sprites and then just save the layout to a json file or something that way the next time you just have to read from the layout (unless you detect a new texture that isn't in the layout, then you'd just rebuild the cache).
stb_rect_pack is nice to pack your textures quickly and in a mostly optimal way
What part do you not understand?
first line in [" ..."]
why does my text look souless as fuck !? where are the kernings? I used bitmap font generator with a microsoft sans serif ttf file. Anyone has the font with kerning pairs or is there an option I am missing in BMFont generator?
I use BMFont generator, I have never gotten any kerning pairs out of it to the best of my knowledge, the functionality seems to be broken, I just use fonts that work well without them
Ivans' have their version of BMFont with kerning but I i have to install this with QT so no dice
github.com
I'm about to finish the alpha version of my vim plugin that acts as a client for jira in vim. Pretty excited, this is probably the biggest project I've ever created so far in my life.
what's QT?
The GUI C++ framework that is crossplatform. And if you ever looked at the Tesla infotainment system.
You know what QT is capable off.
qt in op, nah it is a cross platform gui framework
What is the best language for GUI design/implementation?
pretty shit that the link for the binary is down, that tool looks better than BMFont but I don't want to fuck around compiling someone elses source code
something dynamically typed with first class functions and closures
#include
#define DEFINE_RESULT(T, E, NAME) \
typedef struct { \
bool success : 1; \
union { \
T result; \
E error; \
}; \
} NAME;
From a technical standpoint dart is one of the best scripting languages compared to python or javascript..
Its just not that popular and python is too mainstream and has a huge eco system with alot of libs.
So yeah.. people dont always use "the best".
I am doing it in c++ fren
>Another way I find better is to build a texture atlas at runtime from lots of small sprites and then just save the layout to a json file or something that way the next time you just have to read from the layout
how to do this? Also i have no idea what you meant by most of what you said.
Doesn't exist but redlang is the closes we have. logo related
pseudocode?
I'm making a game in python.
First thing I've made beyond simple scripts or solving algorithm problems.
I used outline detection for one of my projects to build frames out of sprite sheets
pretty superflourous really as it wastes time scanning the image for borders but it's something you can do
what's the benefit of a sprite sheet over a sprite directory, if any?
Basically you put all your sprites inside a single texture, at runtime. en.wikipedia.org
Instead of rebuilding from scratch everytime you start your game, you can write the configuration (x,y offsets of each sprite into the atlas) to a config file (like json).
When you start your game, loop through the texture paths and check if it's inside the config file. If it's not, you need to rebuild the texture atlas from scratch.
The GPU doesn't have to bind 100s of different texture and you can draw your whole scene in a few draw calls
its much easier to work with multiple sprites in a single image than thousands of images in the same folder
nice
What kind of game?
>[".."]
This is the syntax for attributes(aka annotations or metaclasses). This particular attribute enables you to control the visibility of COM compatible types in your managed (.net) assembly if you decide to turn it into a COM Interop component and use it from other COM compliant langs.
COM is microsoft's object model. Basically a uniform way to lay out an object in memory.
Since IList is COM visible, you can access it from langs that can understand COM like C++ as a COM Interface.
Since the generic alternative IList is.. generic and COM doesn't support generic types, it won't be COM compatible but rather just the usual CLS/COMPlus compliance (aka .net)
I want to make it work on Linux and Mac can i use COM?
line 1 is an attribute (docs.microsoft.com
int main()
{
vector A = {"cat", "dog", "frog"};
for (int j = 0; j < A.size(); ++j)
{
for (int b = 0; b < A.size(); ++b)
{
if (j != b)
cout
COM should be platform independent but implementation is another story. The docs say this also applies to .net core so try that.
yup just check inside my ttf file. no kern table as far as i can tell
how to deal with code being not elegant?
this has always been issue for me.
not that the code is riddled with bugs but i always seem to take the longer route.
A roguelike. Nice simple turn based shit. Though I'm using an SDL library rather than the console. Might try and change that, but no one has anything good to say about curses.
elegance is an illusion, an imaginary construct in your own head
example of inelegant code?
All Scala and Kotlin code in existance.
p xs = [ x ++ y | x
Whats wrong with ncurses?
- Write stub functions
- Add tests
- Implement stub functions
Don't care about how 'elegant' the implementation is. Just make it work. You can always refactor it afterwards.
I don't know, I'm a newfag and haven't got around to trying it yet. But whenever I see anyone mention it they mostly talk about it being a pain to use.
that may be but there is always a solution with less lines of code.
and not directly related but people more experienced than me that propose these shorter/more elegant solutions.
one can not but stop and ask himself,am i doing this right?
unsigned int v; // word value to compute the parity of
v ^= v >> 16;
v ^= v >> 8;
v ^= v >> 4;
v &= 0xf;
return (0x6996 >> v) & 1;
there was arbitrary limit of solving this in 12 bitwise operations or less.
my solution took 11 and this is solved in 9.
still good but not as good.
hope you can see where im getting at
if your code is too short then it can be less clear to read
all you need to do is find a balance