Ecere SDK/eC Forums http://ec-lang.org/community/ Print view |
|
Displaying Sprites http://ec-lang.org/community/viewtopic.php?f=5&t=239 |
Page 1 of 1 |
Author: | mothdragon [ Mon Jul 23, 2012 9:34 pm ] |
Post subject: | Displaying Sprites |
Okay, so this isn't all of the executable code, but it is the pertinent stuff. All of this code, in my mind should result in the displaying of a 72x72 graphic, from a tile sheet where the tile in question is from (0,0) - (71,71)... I've adapted this from the KBState sample, but so far as I could tell I kept everything from that sample that was needed, so why is it that my graphic isn't shown? Note that there are some variables included here that aren't used yet... Knowing me it's some tiny little oversight... Code: Select all
|
Author: | jerome [ Mon Jul 23, 2012 10:15 pm ] |
Post subject: | Re: Displaying Sprites |
Hi Charlie, I've tried this with a random bitmap and I did see a tile show up. Could you please attach your exact code and bitmap, always easier to help you find what the problem is I had to add a 'GameWindow gameWindow { };' instance , change the file name to the graphics I was using, and comment out the autoCreate = false... Regards, Jerome |
Author: | mothdragon [ Mon Jul 23, 2012 11:08 pm ] |
Post subject: | Re: Displaying Sprites |
I suppose that's reassuring, but that really confuses me... I've attached a .7z of my project. **Correction, I attempted to attach the .7z file... but I have no idea where it went, and no link appeared in my post. I'll email it to you directly. |
Author: | jerome [ Tue Jul 24, 2012 12:24 pm ] |
Post subject: | Re: Displaying Sprites |
I attached the .7z you sent me to the post. Don't know why it worked for me? I figured out what the problem was. It's a bit tricky. If you take out MainProg.ec of the project, and then add it back at the end of the project, the bush will display fine. The problem is that the MainFrame program was being instanciated before the tilesetGfx, and so when doing res = tilesetGfx, res was null. Thus the order in which instances are created became important... Ideally the order of files in the project shouldn't matter, but this is still something I need to improve I found this out by putting a breakpoint in TileObject::Render and looking at the value of 'bmp' and 'res' (null). Another way would be to move the program instance after tilesetGfx in game.ec (You would need to add import "MainProg" at the top), or move tilesetGfx before program in MainProg.ec (You would need to add import "Game" at the top). Regards, Jerome |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |