Skip to content

Commit

Permalink
Fix maximized mouse click
Browse files Browse the repository at this point in the history
  • Loading branch information
drandarov-io committed Dec 29, 2018
1 parent b1bd6ea commit bc58fe2
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class GoLDemo : PApplet() {

// TODO Implement new ruleset -> either all < 3 distance || that fancy Dewdney one
// TODO Improve camera
// TODO Fix maximized mouse click detection

companion object Factory {
var world: World = createWorld(10, 15, 4)
Expand Down Expand Up @@ -71,9 +70,9 @@ class GoLDemo : PApplet() {

override fun mouseClicked() {
if (mouseButton == LEFT) {
val z = ((mouseX + sliceGap) / sliceWidth).toInt()
val z = ((mouseX + sliceGap - (width - sliceWidthSum) / 2) / sliceWidth).toInt()
val y = ((mouseY - (height - sliceHeightSum)) / (size + gap)).toInt()
val x = ((mouseX - (sliceWidth * (z))) / (size + gap)).toInt()
val x = ((mouseX - (width - sliceWidthSum) / 2 - (sliceWidth * (z))) / (size + gap)).toInt()

println("clicked x=$x, y=$y, z=$z")
world = world.flipAt(x, y, z)
Expand Down

0 comments on commit bc58fe2

Please sign in to comment.