Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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 3430 times)
0 Members and 1 Guest are viewing this topic.
Offline Zerolife

Senior Newbie

« Posted 2010-06-07 03: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 Bitwise Duke »

Medals: 167
Projects: 4
Exp: 14 years

Esoteric Software

« Reply #1 - Posted 2010-06-07 05: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 Wizard

Medals: 80
Projects: 4

I always win!

« Reply #2 - Posted 2010-06-07 09: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.:

Image img = new Image(200,200);
Graphics g = img.getGraphics();
Pages: [1]
  ignore  |  Print  

hadezbladez (276 views)
2018-11-16 13:46:03

hadezbladez (154 views)
2018-11-16 13:41:33

hadezbladez (287 views)
2018-11-16 13:35:35

hadezbladez (69 views)
2018-11-16 13:32:03

EgonOlsen (2124 views)
2018-06-10 19:43:48

EgonOlsen (2148 views)
2018-06-10 19:43:44

EgonOlsen (1361 views)
2018-06-10 19:43:20

DesertCoockie (1957 views)
2018-05-13 18:23:11

nelsongames (1598 views)
2018-04-24 18:15:36

nelsongames (2245 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!