image resizing?

Forum for the creative side of the game development process: art, music, storyline, gameplay, concepts, etc. Any sort of relevant discussion is welcome here.

Moderator: PC Supremacists

h0ts0up
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Fri Jun 05, 2009 6:17 pm

image resizing?

Post by h0ts0up »

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?
User avatar
dandymcgee
ES Beta Backer
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?

Post by dandymcgee »

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?
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. ;)
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
h0ts0up
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Fri Jun 05, 2009 6:17 pm

Re: image resizing?

Post by h0ts0up »

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. :)
User avatar
PixelP
Chaos Rift Regular
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?

Post by PixelP »

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
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: image resizing?

Post by Ginto8 »

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
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. :lol: I prefer the prior, but it's your choice. :mrgreen:
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.
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: image resizing?

Post by eatcomics »

Ginto8 wrote:badass
A child of your age should not be speaking such discrepancies!!!! :lol:
Image
User avatar
short
ES Beta Backer
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?

Post by short »

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.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
dandymcgee
ES Beta Backer
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?

Post by dandymcgee »

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.
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).
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
short
ES Beta Backer
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?

Post by short »

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:

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;
	 }
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?
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
dandymcgee
ES Beta Backer
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?

Post by dandymcgee »

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?
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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
short
ES Beta Backer
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?

Post by short »

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
User avatar
dandymcgee
ES Beta Backer
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?

Post by dandymcgee »

short0014 wrote:It was more of a "how would one do this" theoretical question, tbh. ;)
Either draw one for each possible resolution, or scale it with some sort of API function or pixel manipulation (OpenGL handles this quite easily).
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
derbon
Chaos Rift Cool Newbie
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?

Post by derbon »

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
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: image resizing?

Post by eatcomics »

You're a bad idea!... Y u b hatin on da SDLs son???
Image
User avatar
Sanshin77
Chaos Rift Regular
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?

Post by Sanshin77 »

derbon wrote:SDL is a BAD IDEA
What's a better idea then, and why?
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
Post Reply