Created
July 13, 2020 10:31
-
-
Save usbharu/5555aa212095ec88859f6979ea4a72aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int grid_s=10; | |
boolean mouse_flg=false; | |
boolean button_flg=false; | |
int grid(int p1) { | |
int p; | |
p = p1-p1%grid_s; | |
return p; | |
} | |
int mX() { | |
int p; | |
p= mouseX-mouseY%grid_s; | |
return p; | |
} | |
int mY(){ | |
int p; | |
p = mouseY-mouseY%grid_s; | |
return p; | |
} | |
part hoge = new part(); | |
button b = new button(0,10,200,200,"text"); | |
void setup() { | |
size(500,500); | |
hoge.new_parts(0,"dd","https://blog-imgs-141.fc2.com/h/a/r/harujisaku/20200610070849042.png",0,0); | |
} | |
void draw() { | |
if (button_flg==true) { | |
background(120,120,120); | |
}else{ | |
background(150,150,150); | |
} | |
b.redraw(); | |
hoge.redraw_parts(); | |
println(button_flg); | |
// delay(100); | |
} | |
void mousePressed() { | |
mouse_flg=hoge.poscheck(); | |
if (b.bool()){ | |
button_flg=true; | |
} | |
} | |
void mouseReleased() { | |
if (mouse_flg==true){ | |
hoge.move_parts(mX(),mY()); | |
} | |
if (b.bool()){ | |
button_flg=false; | |
} | |
} | |
void mouseClicked() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment