Rotation
Moderator: Coders of Rage
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Rotation
Okay, so i'm making a game with sdl, and i need to rotate an image a ceartain number of degrees depending on which way the character is facing. I've heard of using SDL_gfx's rotozoom, and prerotating and storing the images in an array, but doesnt this take up an insanely large amount of space? 4 frames of animation * 6 characters * 360 degrees and not to mention all the leveldata and variables, wont this crash cuz of memory?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Rotation
You wouldn't be storing every single little degree of rotation. Store maybe every 20-45 degrees.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Rotation
But I want it to have the best level of realism and be really smooth...
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Rotation
Then don't use SDL. Unfortunately, as great as it is, it has limitations just like every other API. I was trying to accomplish this very task recently which is why I started playing with OpenGL to begin with.ibly31 wrote:But I want it to have the best level of realism and be really smooth...
My recommendation would be the same as Falco's, don't store every single angle. 1/10th of them (36 frames) would look very realistic, but I'm betting even just 18 frames would still look excellent if the FPS was even slightly decent.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Rotation
Okay, well I download "SDL_gfx" the library that has a rotozoomer. And I had to use a new tar.gz extracter program to do it. I have a big list of files, and I'm not entirely sure how to add it to my program... I have done SDL_ttf and SDL_image, but this has .c files so I dont really know. Can anyone help me?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Rotation
Please answer, because I can't do anything with my game until i get this resolved...
EDIT:
Okay, so I'm looking at it, and it has all these weird file types, so I'm assuming this was made for linux or something... I have windows xp, does that mean I can't use it? Ugh, why does it have to be so complex, why can't it just have a lib and include directory?! sigh.
EDIT:
Okay, so I'm looking at it, and it has all these weird file types, so I'm assuming this was made for linux or something... I have windows xp, does that mean I can't use it? Ugh, why does it have to be so complex, why can't it just have a lib and include directory?! sigh.
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.
Re: Rotation
Try this for Visual Studio:
Compiling SDL_gfx (2.0.17) on Visual Studio 2008 (VS9)
or this one for Code::Blocks:
Building SDL_gfx for Mingw under Windows
I haven't tried the Visual Studio one, but I was able to build the DLL with the Code::Blocks one. Hopefully you can get it working with this.
Compiling SDL_gfx (2.0.17) on Visual Studio 2008 (VS9)
or this one for Code::Blocks:
Building SDL_gfx for Mingw under Windows
I haven't tried the Visual Studio one, but I was able to build the DLL with the Code::Blocks one. Hopefully you can get it working with this.
- ibly31
- Chaos Rift Junior
- Posts: 312
- Joined: Thu Feb 19, 2009 8:47 pm
- Current Project: Like... seven different ones
- Favorite Gaming Platforms: Xbox 360, Gamecube
- Programming Language of Choice: C++, ObjC
- Location: New Jersey.
Re: Rotation
Thank you very much, that helped a lot. I have it working now. But I have a small problem... When SDL_gfx rotates the image, it must fill the unrotated part with Transparency pixels... and thus changing the bounding box... so it looks like my character is bumping up and down instead of rotating in place... is there any way of blitting an image by its center instead of top left corner?
Website/Tumblr
My Projects
The best thing about UDP jokes is that I don’t care if you get them or not.