Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Draw image to a grid based on mouse click  (Read 395 times)
0 Members and 1 Guest are viewing this topic.
Offline Shazer2

Jr. Member
**

Posts: 66
Medals: 3



« on: 2012-01-18 20:54:07 »

What I am wanting to achieve is for my image to be drawn at coordinates divisible by 24 only. Let's say I click at 170, 80 I need to find the closest coords (x AND y) that are divisible by 24 and draw the image there.

I can't think of a suitable method to do this, so if anyone can provide some guidance for me that would be much appreciated.

~Shazer2

"When you want to be successful as bad as you want to breathe, then you will be successful." - Eric Thomas
Offline StonePickaxes

Full Member
**

Posts: 204
Medals: 3


Nathan Kramber


« Reply #1 on: 2012-01-18 21:04:06 »

Couldn't you just make the coordinates doubles, then divide them by 24, cast to an int, then multiply by 24?

-Nathan

Check out my website!
Offline Shazer2

Jr. Member
**

Posts: 66
Medals: 3



« Reply #2 on: 2012-01-18 21:18:53 »

I should have wrote on the thread that I got it sorted. Thanks anyway, StonePickaxes.

~Shazer2

"When you want to be successful as bad as you want to breathe, then you will be successful." - Eric Thomas
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.067 seconds with 20 queries.