バイナリクロック
Posted feedbacks - HSP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #uselib "user32.dll"
#func PostMessage "PostMessageA" int,int,int,sptr
#cfunc GetWindowLong "GetWindowLongA" int,int
#func SetWindowLong "SetWindowLongA" int,int,int
#undef BITNUM
#define global ctype BITNUM(%1) (1 << (%1))
#define WIN_HEIGHT 30
#define CELLSIZE 10
#define CX_MARGIN 1
#define CY_MARGIN 1
cx = 60 + CX_MARGIN * 2
cy = WIN_HEIGHT + CY_MARGIN * 2
bgscr IDW_MAIN, cx, cy, 2
SetWindowLong hwnd, -20, ( GetWindowLong(hwnd, -20) | 0x80 )
gsel IDW_MAIN, 2
onclick gosub *OnMove
onkey gosub *OnKeyProc
goto *mainlp
*mainlp
gosub *LCalcData
gosub *LRedraw
await 10
goto *mainlp
*LCalcData
nTime = gettime(4), gettime(5), gettime(6)
return
*LRedraw
redraw 2
color 192, 192, 192 : boxf
color
px1 = CX_MARGIN - 1
py1 = CY_MARGIN - 1
px2 = ginfo(12) - CX_MARGIN
py2 = ginfo(13) - CY_MARGIN
boxf px1, py1, px2, py2
foreach nTime
h = (192 / length(nTime)) * cnt
for i, 0, 6
if ( nTime(cnt) & BITNUM(5 - i) ) {
s = 255 - ((255 / 10) * i)
v = 255 - ((255 / 10) * i)
hsvcolor h, s, v
} else {
color 255, 255, 255
}
px1 = CX_MARGIN + ( i * CELLSIZE)
py1 = CY_MARGIN + (cnt * CELLSIZE)
px2 = CX_MARGIN + (( i + 1) * CELLSIZE) - 2
py2 = CY_MARGIN + ((cnt + 1) * CELLSIZE) - 2
boxf px1, py1, px2, py2
next
loop
redraw 1
return
*OnMove
if ( wparam == 1 ) {
sendmsg hwnd, 0x00A1, 2, 0
}
return
*OnKeyProc
if ( iparam == 27 ) { // [Esc]
gosub *LQuit
}
return
*LQuit
PostMessage hwnd, 0x0010, 0, 0
return
|


lunlumo #9282() [ Ruby ] Rating6/8=0.75
20:18の場合,例えば以下の様な出力をするイメージです。
出力例:
■□■□□
□■□□■□
see: Binary Clock Widget
Rating6/8=0.75-0+
[ reply ]