ちらつきを無くすためにredrawを使うとどうしても描画がスムーズにならず行き詰っております。
私の環境では滑らかに動いているのに何故か途中で画面全体(マウスカーソルを含む)が一瞬止まったりする感じで不自然です。
redrawを消すと改善するのですが、当然ちらつきが出てしまいます。
皆さんの環境ではどうなりますでしょうか?
何か分かれば何でも教えて欲しいです!
//透過ウィンドウ準備 #uselib "user32.dll" #cfunc GetWindowLongA "GetWindowLongA" int,int #func SetWindowLongA "SetWindowLongA" int,int,int #func SetLayered "SetLayeredWindowAttributes" int,int,int,int #func SetParent "SetParent" int,int #func SetWindowLong "SetWindowLongA" int,int,int;ウィンドウの透明化・半透明化・不透明化_用↓ #func SetLayeredWindowAttributes "SetLayeredWindowAttributes" int,int,int,int #const LWA_COLORKEY 1 ;透明色を指定 #const LWA_ALPHA 2 ;アルファー値を指定 #const GWL_EXSTYLE -20 ;拡張ウィンドウスタイル #const WS_EX_LAYERED $00080000 ;透明なウィンドウ属性 #const WS_EX_TRANSPARENT $00000020 bgscr 0,ginfo(20),ginfo(21),0,0,0:gsel 0,2:title"雪" // 1,1,1 を透過色として利用 color 1,1,1:boxf //ウィンドウすり抜け SetWindowLong hwnd,-20,WS_EX_LAYERED|WS_EX_TRANSPARENT // 背景(ID 1)を 透明化 & 子ウィンドウ化 SetWindowLongA hwnd,-8,_hwnd SetWindowLongA hwnd,-20,GetWindowLongA(hwnd,-20)|0x00080000 SetLayered hwnd,0x010101,0,1 ;準備 max=55 ddim x,max:ddim y,max:ddim xx,max:ddim yy,max:dim size,max:dim a,max:randomize repeat max x(cnt)=rnd(ginfo(20)*2.5)-ginfo(20):y(cnt)=rnd(ginfo(21))*-1 size(cnt)=rnd(10)+5 xx(cnt)+rnd(5)-2 yy(cnt)=1:b=0.0:b+rnd(9)+1:b/10:b+rnd(9)+1:yy(cnt)+b loop ;メインループ *main redraw 0 repeat max a(cnt)=rnd(5) if a(cnt)=0:b=0.0:b+rnd(21)-10:b/15:xx(cnt)+b : if xx(cnt)>2.0:xx(cnt)=2.0:else:if xx(cnt)<-2.0:xx(cnt)=-2.0 if xx(cnt)=0.0:b=0.0:b+rnd(21)-10:b/15:xx(cnt)+b x(cnt)+xx(cnt):y(cnt)+yy(cnt) if y(cnt)>ginfo(21){ x(cnt)=rnd(ginfo(20)*2.5)-ginfo(20):y(cnt)=rnd(ginfo(21))*-1 if x(cnt)<-15|x(cnt)>ginfo(20)+15:y(cnt)=rnd(ginfo(21)):else:y(cnt)=-15 size(cnt)=rnd(10)+5 yy(cnt)=1:b=0.0:b+rnd(9)+1:b/10:b+rnd(9)+1:yy(cnt)+b } loop color 1,1,1 boxf color 245,245,245 repeat max circle x(cnt),y(cnt),x(cnt)+size(cnt),y(cnt)+size(cnt),1 loop await 16 redraw 1 await 0 goto*main