|
This thread is locked; no one can reply to it. |
1
2
|
(X)ubuntu, Nvidia Drivers, VSYNC and overheating CPU/GPU |
Yodhe23
Member #8,726
June 2007
|
Oh my code is perfectly clean and readable (to me). It is probably just not how you (or anyone else) would do things, but it works for me. Ahhhh the joys of BASIC on the speccy rubber keyboard when you didn't have to type out everything, and all variables were global, and functions were just gosubs.... Brings back a tear to this middle-aged man. So would you have any pointers on reusing textures to use instead of creating bitmaps every time as a potential solution. www.justanotherturn.com |
Thomas Fjellstrom
Member #476
June 2000
|
Yodhe23 said: So would you have any pointers on reusing textures to use instead of creating bitmaps every time as a potential solution. Hm, well you can load them at start like you suggested, and store them in a convenient place (an array perhaps? or a struct with a bunch of individual ALLEGRO_BITMAP pointers?). -- |
Yodhe23
Member #8,726
June 2007
|
Oh I did that already, just as you suggested with an array of bitmaps created at the start of the function, instead of in the event loop. www.justanotherturn.com |
Thomas Fjellstrom
Member #476
June 2000
|
Without splitting out the actual resource management into a separate set of functions, that may be the easiest solution. you can even setup defines or constnats to "name" bitmaps: enum { PLAYER_SPRITE_N = 0, PLAYER_SPRITE_W, HUD_BACKGROUND, ... }; al_draw_bitmap(bitmap[HUD_BACKGROUND], ...);
-- |
Yodhe23
Member #8,726
June 2007
|
I use defines for that purpose. Though enums have that nice list ability, again another hang over of learning programming back in the day. P.s Yay memory is back down to 150Mb usage. www.justanotherturn.com |
Thomas Fjellstrom
Member #476
June 2000
|
I used to use defines all the time, but i'm starting to like enums more Also glad you got things manageable. -- |
|
1
2
|