Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » (X)ubuntu, Nvidia Drivers, VSYNC and overheating CPU/GPU

This thread is locked; no one can reply to it. rss feed Print
 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
avatar

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?).

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

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
avatar

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], ...);

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

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
avatar

I used to use defines all the time, but i'm starting to like enums more :)

Also glad you got things manageable.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

 1   2 


Go to: