Jump to content
  • Advertisement
Sign in to follow this  

[Java]Basic Isometric Issue

This topic is 4418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, This is my first post on this forum, although i have visted this site on and off for a couple of years. I am an amateur programmer currently trying to create an isometric tile editor. I have been using this article for techniques - http://www.gamedev.net/reference/articles/article747.asp I am having trouble with the section "mouse matters", when the tile image is colored at corners, in order to + or - the selected row/col. I understand how this works. Currently my program creates the colored diamonds at the click of a button. The tile size is 198*100. Clicking on the tile then displays the row/col, as well as the internal coordinates of that tile (mouseX,mouseY). I have been stuck for a week on how to get the RGB color of the pixel on the tile. I am using JLabels instead of bufferedimages. PixelGrabber does not work, and after extensive googling, i read it is apparently very bad to use it anyway since java 1.1. As i am incapable of getting it to work, is anyone aware of another method to use, explained simply? I do not know what code i need to post. i assume any code has to go into the area where the ActionEvent (mouseclick) occurs. regards A.A.

Share this post

Link to post
Share on other sites
Use buffered image instead of JLabel and use the getRGB method. JLabel is probably a poor choice for storing a mousemap. Even if you need to display the mousemap to the user, you don't need a JLabel.

You'll get an integer representing a pixel in the TYPE_INT_ARGB color model (see docs linked below).

So if you need to get the RGB out... can do something along the lines..

int red = 0xffff0000; //(the format is AARRGGBB)
int blue = 0xff0000ff;
int green = 0xff00ff00;
int white = 0xffffffff;

int pixel = mouseMap.getRGB(mouseX, mouseY);

if(pixel == red) ; //etc...



Share this post

Link to post
Share on other sites
Hi, and thanks for reply.

I got the method to work, to an extent.
My program can create a "templateMap" consisting of the colored diamonds and using RGB to get row/col offsets.. My program can also create a "normalMap" consisting of normal diamond tiles.

Alone, they both work, but not together (when they form 2 seperate layers).

I intend to have the "templateMap" at the bottom, with a mouseListener picking up RGB values. On top of that will be the "normalMap" which the user clicks and the row/col will be displayed, depending on the RGB values from "templateMap".

I just need to link htese 2 together and hope it works.

thankyou for help,


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!