![]() |
|
Weird Sprite Handler |
horizon981
Member #7,594
August 2006
|
I wanted to make a program to load sprites from a sprite strip and a simple sprite engine.
Thanks in advance! |
Kauhiz
Member #4,798
July 2004
|
Quote:
struct Sprites void setup_sprites(Sprites *Sprite) That's wrong. Do struct Sprites { int x, y; int xSpeed, ySpeed; int xDir, yDir; bool isAlive; int delay; int curFrame, maxFrame; }Sprites;
Edit: For clarification, right now you have a struct called monster, but use a struct called Sprites. Also, again, drop the ; at END_OF_MAIN() --- |
horizon981
Member #7,594
August 2006
|
In case you didn't notice, Sprite is a pointer to struct monster. |
Kauhiz
Member #4,798
July 2004
|
Sprite is declared as Sprites *Sprite. So, what is Sprites? --- |
Kitty Cat
Member #2,815
October 2002
![]() |
You're doing more than drawing to the screen between the acquire/release_screen pairs. You don't need to call them at all when you only draw to the screen once per loop. -- |
horizon981
Member #7,594
August 2006
|
Sprites is a structure that holds all the data about a sprite. monster is an instance of this structure. Sprite is a pointer to monster. Does that help? |
Kauhiz
Member #4,798
July 2004
|
Wait, I think you're right, what was I looking at... Well, Kitty Cat is right anyway, the acquire/release bitmap calls are placed horribly, either get rid of them all together or just put them around the blitting (right now they're both outside the main loop --- |
horizon981
Member #7,594
August 2006
|
Thanks a lot!! |
Jonny Cook
Member #4,055
November 2003
|
If I remember correctly, you can only do drawing operations between acquire/release_screen() calls. And they are only beneficial when you draw to the screen multiple times in a row, which you aren't doing. The face of a child can say it all, especially the mouth part of the face. |
miran
Member #2,407
June 2002
|
You should throw the book you're reading out the window. It's no good. -- |
Kauhiz
Member #4,798
July 2004
|
The screen needs to be acquired before it's drawn to. After that, it needs to be released. Blit does this automatically, unless you do it manually. The reason you may want to do it manually, is that if you draw a lot of stuff to the screen, it's better to acquire the screen then draw everything and release the screen than acquire before and release after every blit. The way you had it would release the screen after the user presses ESC, which just terrible. --- |
horizon981
Member #7,594
August 2006
|
So, is double buffering as good as manually acquiring the screen? |
BAF
Member #2,981
December 2002
![]() |
You should be double buffering anyway. And its like comparing apples to oranges, double buffering has nothing to do with acquiring the screen. |
Kikaru
Member #7,616
August 2006
![]() |
From my limited experience, double buffering eliminates flickering, really helps when using a custom mouse pointer. Also, I've never used acquire_screen() - release_screen() functions, and all my games have run pretty well. |
|