![]() |
|
Allegro Crash... |
deck42
Member #8,422
March 2007
|
Hey! I am getting really frustrated about allegro crashing all the time. Can`t find no reason. Using Dev c++, 4.9.9.2. Take a look at the code below please... The thing is, if I remove all textout calls, then it crashes only very few times. If I add textout lines it will start but crash soon after (after having worked correctly for some seconds). If I do double buffering like in the example below, it will crash imidiatelly at start, without working at all. What is the problem, any ideas? int main(){ std::string output1; release_screen(); return 0; |
miran
Member #2,407
June 2002
|
You need to initialize the buffer to point to a BITMAP that you create. It should be the size of the screen. Also there are several other small and non-critical errors in your code... EDIT: Also you should RTFM before you go and reinvent the wheel (e.g. for printing numbers). Usually the preexisting wheel works just fine and often your own turns out square. Just an advice... EDIT2: Your code should look like this:
You should also do error checking.... -- |
deck42
Member #8,422
March 2007
|
Yeah sorry forgot and justed added that, now it seems to run. But still it`s not clear to me why it crashed when I was drawing directly to the screen... what other errors do you see? |
CGamesPlay
Member #2,559
July 2002
![]() |
This is not Allegro's fault, it's your fault. Use code tags. Read the documentation for show_mouse:show_mouse They say that you have to install_timer in order to show_mouse. The docs also say not to draw to the bitmap while it has show_mouse called on it. Read the docs to find out how to fix. IntToString is probably causing your crash, by the way. [append] Quote: But still it`s not clear to me why it crashed when I was drawing directly to the screen... Quote:
textout_ex( buffer, font, output1.c_str(), 10, 10, makecol( 255, 0, 0), makecol( 0, 0, 200)); show_mouse(buffer); draw_sprite( screen, buffer, 0, 0);
All 3 of those will crash. -- Ryan Patterson - <http://cgamesplay.com/> |
miran
Member #2,407
June 2002
|
I edited my previous post while you were typing... -- |
deck42
Member #8,422
March 2007
|
Well thx alot, but now I got an even more intersting question. :-) |
miran
Member #2,407
June 2002
|
Quote: What does "RTFM" mean? EDIT: Scratch that, acronymfinder doesn't even have the right definition... Quote: I mean what "wheel" were you refering to for printing numbers, I was searching for hours and hours for such a "wheel" before I did my own... -- |
deck42
Member #8,422
March 2007
|
Thx! Really funny: I found that function yesterday myself but didn`t get how its meant to draw numbers... now I see. :-) Everything runs smooth now thx |
GullRaDriel
Member #3,861
September 2003
![]() |
Miran said: acronymfinder doesn't even have the right definition... Actually, they do: [quote ] But here at allegro.cc, it is more Read The 'F ucking' Manual _ "Code is like shit - it only smells if it is not yours" |
CGamesPlay
Member #2,559
July 2002
![]() |
Read The Fu..err..Free Manual! -- Ryan Patterson - <http://cgamesplay.com/> |
Onewing
Member #6,152
August 2005
![]() |
Oh, I always thought it meant, "Rotting Tomatoes For Me." ------------ |
Kikaru
Member #7,616
August 2006
![]() |
That it does! |
|