image resizing?
Moderator: PC Supremacists
image resizing?
I'm uber nub when it comes to game dev and even more nub when it comes to programming. I just started dabbling with SDL and recently learned that there is no function for resizing images. I drew an image of a meadow and what not as a background and applied it to a surface and found that it was a portion of the image rather than the entire image. When you're making your sprites and maps, are you making the images to scale, or are you using a different library where you resize it to fit?
- 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: image resizing?
Generally sprites are drawn to size from the start, and maps are made up of tiles (a bunch of fragments of a larger image stored as rectangles to save memory when you use them more than once). Images not made up of tiles (title screens, backgrounds, etc.) are generally drawn to size as well. Of course these observations apply directly to 2D games (where the majority of my experience lies), 3D is a whole different ball game.h0ts0up wrote: When you're making your sprites and maps, are you making the images to scale, or are you using a different library where you resize it to fit?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: image resizing?
thanks, my goal by the end of this summer is to write my own 2d sidescroller. So, your expertise was just what I was looking for.
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: image resizing?
if you really want to resize an image i guess you can use sdl_gfx, but im not sure.
i would use sfml for that though. sfml has some nice image manipulation functions.
http://www.sfml-dev.org/documentation/1 ... Sprite.htm
i would use sfml for that though. sfml has some nice image manipulation functions.
http://www.sfml-dev.org/documentation/1 ... Sprite.htm
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: image resizing?
or you could use OpenGL, which uses texture mapping. This mapping makes resizing (in any direction) a breeze. Or you could be hardcore in SDL and do some badass and insanely difficult pixel manipulation. I prefer the prior, but it's your choice.PixelP wrote:if you really want to resize an image i guess you can use sdl_gfx, but im not sure.
i would use sfml for that though. sfml has some nice image manipulation functions.
http://www.sfml-dev.org/documentation/1 ... Sprite.htm
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Re: image resizing?
A child of your age should not be speaking such discrepancies!!!!Ginto8 wrote:badass
- short
- ES Beta Backer
- Posts: 548
- Joined: Thu Apr 30, 2009 2:22 am
- Current Project: c++, c
- Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
- Programming Language of Choice: c, c++
- Location: Oregon, US
Re: image resizing?
Rather then make a new post, I will ask in here: What about background files? They are drawn to scale at the beginning, but what about different resolutions? On my computer I use a 1440 x 900 resolution, and a 1440 x 900 file,but my friends laptop won't go that large, and therefore fails to load the file. Is my only choice to have a different background file for every possible resolution?
edit: I am using straight SDL for this project, the next game I think I will try and start learning open GL.
edit: I am using straight SDL for this project, the next game I think I will try and start learning open GL.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
link: https://github.com/bjadamson
- 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: image resizing?
When you initialize the SDL window, you specify the resolution. This eliminates the need to make sure the image fits a user's desktop resolution (unless of course you try to make the window re-sizable).short0014 wrote:Rather then make a new post, I will ask in here: What about background files? They are drawn to scale at the beginning, but what about different resolutions? On my computer I use a 1440 x 900 resolution, and a 1440 x 900 file,but my friends laptop won't go that large, and therefore fails to load the file. Is my only choice to have a different background file for every possible resolution?
edit: I am using straight SDL for this project, the next game I think I will try and start learning open GL.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- short
- ES Beta Backer
- Posts: 548
- Joined: Thu Apr 30, 2009 2:22 am
- Current Project: c++, c
- Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
- Programming Language of Choice: c, c++
- Location: Oregon, US
Re: image resizing?
I did that, but on my friends laptop it wouldn't initialize without me replacing the file with a new background file that was smaller then 1440 x 900.
Here's my init code:
edit: What I guess I want to ask is, how do I deal with different resolutions on different computers. For example: my friends laptop can't handle 1440 x 900 resolution, but mine can. Is there a simple way of doing this?
Here's my init code:
Code: Select all
//set up the screen.
if(fullscreen == true)
{
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE | SDL_FULLSCREEN);
}
else
{
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);
}
if(screen == NULL)
{
myLog->writeToFile(" screen = null, in init(bool fullscreen) \n");
return false;
}
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
link: https://github.com/bjadamson
- 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: image resizing?
Why do you need such a large window? I usually run 640x480 res in fullscreen mode when devving with SDL, but most if not all modern displays should support 1024x768 just fine. I don't see the need to go any bigger than that.short0014 wrote: edit: What I guess I want to ask is, how do I deal with different resolutions on different computers. For example: my friends laptop can't handle 1440 x 900 resolution, but mine can. Is there a simple way of doing this?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- short
- ES Beta Backer
- Posts: 548
- Joined: Thu Apr 30, 2009 2:22 am
- Current Project: c++, c
- Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
- Programming Language of Choice: c, c++
- Location: Oregon, US
Re: image resizing?
It was more of a "how would one do this" theoretical question, tbh.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
link: https://github.com/bjadamson
- 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: image resizing?
Either draw one for each possible resolution, or scale it with some sort of API function or pixel manipulation (OpenGL handles this quite easily).short0014 wrote:It was more of a "how would one do this" theoretical question, tbh.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- derbon
- Chaos Rift Cool Newbie
- Posts: 54
- Joined: Tue Jun 09, 2009 7:25 pm
- Current Project: Big Nasty Enemies
- Favorite Gaming Platforms: NES SMS snes PC N64 PS2 Vectrex The Arcade Machine
- Programming Language of Choice: C++, Perl
- Location: why shud i tell u u mite steal my tv
- Contact:
Re: image resizing?
SDL is a BAD IDEA
i think the best paint program would be microsoft paint + paint.NET+graphics gale + Paint shop Pro 7 + photoshop CS3, it would be called Paint Gale Pro Shop.NET,
http://youtube.com/gonduda
http://youtube.com/gonduda
Re: image resizing?
You're a bad idea!... Y u b hatin on da SDLs son???
- Sanshin77
- Chaos Rift Regular
- Posts: 160
- Joined: Tue Mar 10, 2009 9:36 am
- Current Project: C++/SDL engine, zaActionWizardMagic game
- Favorite Gaming Platforms: Xbox 360, Playstation 2, Nintendo DS, mac and PC
- Programming Language of Choice: C++
Re: image resizing?
What's a better idea then, and why?derbon wrote:SDL is a BAD IDEA
Check out videos of my C++ games as well as my "Amateur Game Dev" series over at
My YouTube Channel: http://www.youtube.com/user/Zanchill
My YouTube Channel: http://www.youtube.com/user/Zanchill