Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (290)
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  
  Mini Map?  (Read 936 times)
0 Members and 1 Guest are viewing this topic.
Offline Zerolife

Senior Newbie





« Posted 2010-06-07 05:32:13 »

Im trying to make a mini map that is simply the graphics page I am drawing on scaled down to a certain part of the screen, obviously leaving the full image up. It is just going to show the parts of the graphics page that are drawn off screen. I can seem to figure it out though. I am using slick so you all know. If i wasn't using slick, I'd be able to do it as I've done it before, but the graphics and images in slick seem to be much different to increase speed, but its screwing me up -.-

Basically what I tried to do was create an image, and a graphics page, set the image and graphics to be identical, so whenever I draw on the graphics, it sends it to the image (graphics = image.getGraphics()) and then just draw the game to the graphics page, and draw the image to the screen, and draw the image again, but smaller on the gui. Any help is much appreciated.
Offline Nate

JGO Wizard


Medals: 81
Projects: 3


Esoteric Software


« Reply #1 - Posted 2010-06-07 07:55:21 »

I would probably render twice, once for the main play area and once for the minimap. No fancy image buffers, just draw to the screen. Depending on your map size (probably large, since you want a minimap), you probably want to draw a lot less on the minimap anyway.

Offline appel

JGO Ninja


Medals: 35
Projects: 5


I always win!


« Reply #2 - Posted 2010-06-07 11:47:37 »

In short, you need two images, one that has the static background, and another that has the static background merged with the active game objects.

The static background image is only generated once, it contains the terrain of your map.
The merged image is generated every 500 milliseconds or so, you don' t need to do it real-time. Here you simply draw all the game objects you wish to show on the minimap, most commonly just a filled rectangle.

This is quite easy to do.

In slick you can easily create a Image and get it's graphics context to draw to, e.g.:

1  
2  
3  
4  
5  
6  
Image img = new Image(200,200);
Graphics g = img.getGraphics();
g.setColor(Color.red);
g.fillRect(0,0,200,200);
g.flush();
img.draw();

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (64 views)
2013-05-17 21:29:12

alaslipknot (73 views)
2013-05-16 21:24:48

gouessej (104 views)
2013-05-16 00:53:38

gouessej (101 views)
2013-05-16 00:17:58

theagentd (111 views)
2013-05-15 15:01:13

theagentd (101 views)
2013-05-15 15:00:54

StreetDoggy (146 views)
2013-05-14 15:56:26

kutucuk (169 views)
2013-05-12 17:10:36

kutucuk (168 views)
2013-05-12 15:36:09

UnluckyDevil (177 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.079 seconds with 21 queries.