Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Game question

Name: Anonymous 2014-06-16 20:00

I am creating a game (engine) with SDL 2 using C and I am planing to have a scheme dialect to extend it in the future
here is my question, let's say I have N textures that I want to be rendered, should I have them in a list and render them every time something happens to the event loop? The other programmer I am working about is against the idea of having every texture in a list and believes that we should have them normaly in the code like variables, what to do?
another question is how to access other objects by some functions, for example I want every time someone presses the UP button to change the player position but in that case I should a: have the player variable as global or b: pass it in that function, should I have another list or something (like a db) for every object or something?
I have no idea on how to work with game stuff

Name: Anonymous 2014-06-16 20:45

>>2-3
Thank you both very much

typical design is to load textures in as assets, have game objects (tiles, sprites) reference them with pointers or offsets. stored objects might reference them by name, this should be converted to pointer or offset when loaded into memory.
if I understand correctly you need code to save, modify, get values and unload objects while they are stored in a list/tree or something
I was thinking of having functions like these (C-like code)
bool objectSet (tree, const char *name, void *data);
void *objectGet (tree, const char *name);


iirc SDL presumes you will issue redraw for the entire screen every frame and reserves the right to trash your buffers after they've been blitted.
I am using SDL2, is this still a issue?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List