Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  "Scaling" Your Images to Fix Screen Size  (Read 1130 times)
0 Members and 1 Guest are viewing this topic.
Offline jdgamedev

Senior Newbie


Medals: 1


Chillin Like a Villin


« Posted 2012-07-17 20:48:06 »

I hope the title makes sense with what I'm trying to accomplish.

My goal is to create tile maps for a top-down RPG using 32 x 32 tiles. When I display the tiles in an 800 x 648 screen, I lose the look that I'm going for. I want everything to appear bigger.

I'm having a hard time explaining it and wrapping my head around it, but I'd like the tiles to use 32 x 32 pixels, but for them to fit into a bigger size, say 64 x 64.

If this doesn't make sense, I'll try to figure out a way to explain it better, but if anyone actually knows what I'm trying to do, guidance in the right direction would be great. Thanks

I'm on a quest to become a better game developer, check it out.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #1 - Posted 2012-07-17 21:14:29 »

If you're looking for that "blocky big pixel" look, set your texture magnification filter to GL_NEAREST and you'll be all set.
Offline jdgamedev

Senior Newbie


Medals: 1


Chillin Like a Villin


« Reply #2 - Posted 2012-07-17 21:23:51 »

I have no idea what you are talking about... very new to programming.

I'm on a quest to become a better game developer, check it out.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline jonjava
« Reply #3 - Posted 2012-07-17 21:25:14 »

Are you using LWGJL?

I heard you were talking about Notch's ludum dare, are you perhaps trying to figure out what/how he's doing that blocky scaling?

Offline jdgamedev

Senior Newbie


Medals: 1


Chillin Like a Villin


« Reply #4 - Posted 2012-07-17 21:27:22 »

I'm not using any API. He did use something that probably got the same effect I'm looking for.

I'm on a quest to become a better game developer, check it out.
Offline jonjava
« Reply #5 - Posted 2012-07-17 21:33:04 »

IIRC Notch fiddles around with the raster ( array of pixels ) and just scales the image, i.e, draws the image stretched (larger than it actually is).

[EDIT]: So basically:

1  
2  
3  
4  
5  
int scale = 2; // twice the size
int ww = width * scale;
int hh = height * scale;

g.drawImage(x,y, ww, hh, null);

Offline jdgamedev

Senior Newbie


Medals: 1


Chillin Like a Villin


« Reply #6 - Posted 2012-07-17 21:37:54 »

Heh, that makes so much sense...

I'll fiddle around with it. That definitely puts me in the right direction though. Thanks

I'm on a quest to become a better game developer, check it out.
Offline Rorkien
« Reply #7 - Posted 2012-07-17 22:47:36 »

IIRC Notch fiddles around with the raster ( array of pixels ) and just scales the image, i.e, draws the image stretched (larger than it actually is).

[EDIT]: So basically:

1  
2  
3  
4  
5  
int scale = 2; // twice the size
int ww = width * scale;
int hh = height * scale;

g.drawImage(x,y, ww, hh, null);


A workaround to this is to load the image, scale it, and store it into a object. Then you draw from it.
Scaling the image every time you draw it is way too slow
Offline jonjava
« Reply #8 - Posted 2012-07-17 23:14:44 »

That's assuming that the thing he wants scaled is a single image that never changed. For something like the game screen you'd need to re-scale it every frame.

Scaling the image every time you draw isn't as slow as you might think. Certainly not as slow as you make it sound :}

Of course, depends a LOT on the size of the image.

Offline Rorkien
« Reply #9 - Posted 2012-07-18 00:10:04 »

That's assuming that the thing he wants scaled is a single image that never changed. For something like the game screen you'd need to re-scale it every frame.

Scaling the image every time you draw isn't as slow as you might think. Certainly not as slow as you make it sound :}

Of course, depends a LOT on the size of the image.

Maybe, i'm a bit of a performance paranoid person  Grin

And it also depends on how much you want to scale as well
I remember scaling a 24x24 tile to 480x480, 600fps dropped down to ~10
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline StumpyStrust
« Reply #10 - Posted 2012-07-18 00:39:52 »

I have rarely ever seen a major performance hit from scaling. My particles for example change size every frame and scale from sometimes very large or small sizes and I don't drop fps unless there are 1k+ particles. I would still stay away from scaling things to much even though I don't see a any drops it is good practice.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!