Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » i need help

This thread is locked; no one can reply to it. rss feed Print
i need help
chaseC
Member #8,368
February 2007

im using allegro with dev-c++ and i installed all the directories and i can make programs without bitmaps fine but when i try to put a bitmap into the program it just crashes. ive copied examples from many different sources and websites but none of them work i have no idea of why it wont work!!!!!!!!!!!>:(>:(>:(>:(

CGamesPlay
Member #2,559
July 2002
avatar

I'll say. Looks like your shift key is completely broken!

Post a piece of code that compiles and crashes, and post the bitmap that you try to load that doesn't work. Read this before posting code (the bottom line, specifically)

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

chaseC
Member #8,368
February 2007

heres the source code

1 
2#include <allegro.h>
3 
4BITMAP *x;
5 
6 int main(){
7
8 allegro_init();
9 install_keyboard();
10 set_color_depth(16);
11 set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
12
13 x = load_bitmap( "x.bmp", NULL);
14
15 acquire_screen();
16
17 draw_sprite( screen, x, 220, 340);
18
19 release_screen();
20
21 readkey();
22
23 return 0;
24
25 }
26 END_OF_MAIN();

it just comes up with a: send error/dont send error, popup

the X is for a tic-tac-toe game

CGamesPlay
Member #2,559
July 2002
avatar

You need to check that the bitmap was actually loaded.

x = load_bitmap("x.bmp", NULL);
if(x == NULL)
{
    set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
    allegro_message("The bitmap failed to load");
    return 1;
}

When you do this, you will find that the bitmap is never loaded, and trying to draw it on the screen crashes. Possible problems: the bitmap is in the wrong folder.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

chaseC
Member #8,368
February 2007

i thought that there might be a folder i had to put the bitmap in, what is it, right now he bitmap is just in my picures

LennyLen
Member #5,313
December 2004
avatar

Where you put the images depends on whee you tell your program to look for them. If you don't specify a path, then the image needs to be in the same directory as the program. If you're running the program from an IDE, then what directory they need to be in depends on the IDE.

Oh, and please learn to write propely.

Go to: