![]() |
|
This thread is locked; no one can reply to it.
![]() ![]() |
1
2
|
load_bitmap trouble |
Raf Vermeulen
Member #7,166
April 2006
|
I also tried leaving it out of a subdirectory and just plain in the same directory as the executable (with putting this in the code and putting the image there, obviously). Same results. I'll comment out everything except the most necessary and'll try to load and blit it without it being a part of a class. The thing that still confuses me, is how it works fine for one project, but the same code doesn't work in another. Anyways, on to the testing |
CGamesPlay
Member #2,559
July 2002
![]() |
The proper test case should look something like this:
-- Ryan Patterson - <http://cgamesplay.com/> |
Raf Vermeulen
Member #7,166
April 2006
|
That one says: "Bitmap loaded" It crashes with this one:
Result is "Problem with setting gfx mode". |
CGamesPlay
Member #2,559
July 2002
![]() |
It says "Bitmap loaded" when you use the Gfx/Tile.bmp from the attachment in the first post? [append] -- Ryan Patterson - <http://cgamesplay.com/> |
Raf Vermeulen
Member #7,166
April 2006
|
It loads and shows fine now (with the allegro_init()). The bitmap's the one from the attachment (the 10 testing floor-tiles and the crappy stickman). I'll add the code one by one again and'll see where it goes wrong. |
Tobias Dammers
Member #2,604
August 2002
![]() |
Quote: Result is "Problem with setting gfx mode". What graphics mode is your desktop set to? No, wait. Why do you install the SYSTEM_NONE driver and expect it to give you any useful graphics driver? Try this one (fixing some errors along the way):
--- EDIT --- --- |
Raf Vermeulen
Member #7,166
April 2006
|
Ok... this's getting a bit odd. I'm at the point where it says spritesheet not loaded again. That's when I placed if(m_tile == 0) load_tileset("Gfx/Tile.bmp"); if (!m_tile) cout << "Spritesheet not loaded\n"; in Tile::Tile() : /* deze methode is sneller dan wanneer ze in de constructor staan */ size(32), type(0) { if(m_tile == 0) load_tileset("Gfx/Tile.bmp"); if (!m_tile) cout << "Spritesheet not loaded\n"; } This code (in the main loop, which I left in there as double-checking) still works fine: BITMAP* b = load_bitmap("Gfx/Tile.bmp", NULL); if(!b) { cout << "Bitmap failed to load" << endl; system("pause"); return 0; } masked_blit(b, buffer, 0,0,0,0,32,32); cout << "Bitmap loaded" << endl; blit(b, screen, 0,0,0,0,800,600);
|
CGamesPlay
Member #2,559
July 2002
![]() |
You must have a pointer error somewhere... I guess. I'm at a loss, really. Check valgrind or gdb -- Ryan Patterson - <http://cgamesplay.com/> |
Kitty Cat
Member #2,815
October 2002
![]() |
The constructor isn't called globally, is it? It's called after allegro_init and set_gfx_mode? -- |
Raf Vermeulen
Member #7,166
April 2006
|
I get the spritesheet not loaded comment before any other comment, and the global variables're declared above the main-loop, like this:
|
Evert
Member #794
November 2000
![]() |
If the constructor is called before allegro_init() is called, then you're calling an Allegro function before Allegro is initialised - which doesn't work. |
Raf Vermeulen
Member #7,166
April 2006
|
Well I'll be damned. That seems to be the difference between the first project and this one:o Changing the global var declaration part to this did the trick: It still doesn't draw properly, but I'll check all the rest too to make sure things're going as they should. WOO! Fixed a few more flaws and it works like a charm now;D Time to do the actual stuff now... the fun part;D |
|
1
2
|