Skip to content

Instantly share code, notes, and snippets.

@st98
Last active August 29, 2015 14:01
Show Gist options
  • Save st98/158918921f8ed11027e6 to your computer and use it in GitHub Desktop.
Save st98/158918921f8ed11027e6 to your computer and use it in GitHub Desktop.
何となく HSP を書きたくなったので。筆先が回転するお絵描きツール。
*init
screen 0, 256, 256
title "お絵かけない"
angle = 0
pressed = 0
px = 0
py = 0
color 53, 122, 48
boxf
*main
repeat
redraw 0
stick k, 768
if k {
if k & 256 {
color 255, 255, 255
} else : if k & 512 {
color 255, 144, 144
}
x = mousex + 25.0 * sin(double(angle) * M_PI / 180)
y = mousey + 25.0 * cos(double(angle) * M_PI / 180)
if pressed {
line px, py, x, y
} else {
pset x, y
}
pressed = 1
px = x
py = y
} else {
pressed = 0
}
angle = (angle + 25) \ 36
redraw 1
await 17
loop
@st98
Copy link
Author

st98 commented May 13, 2014

27 行目を x = mousex に、28 行目を y = mousey に書き換えると普通のお絵描きツールになります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment