Latest OxygenBasic.zip at GitHub (Click on the Wizard)
0 Members and 1 Guest are viewing this topic.
include "Func.inc"Dim hdc, clk, mx, px, py, wy as longDim a as singleDim msg as string SetWindow "Button Static",640,480,ws_dlgframehdc=BufferDCSetFont hdc,8,14,fw_bold,"times"px=320 : py=240Function DrawRectangle(byval hdc as long, byval x0 as long, byval y0 as long, byval x1 as long, byval y1 as long ,byval color as long)Long x, yFor y=0 To y1For x=0 To x1SetPixel hdc,x0+x,y0+y,colorNextNext End FunctionSub Delay(byval time as long)Long Tick, cTime cTime = timeGetTime Tick = cTime + timeWhile Tick > cTimecTime = timeGetTimeWend End SubSub Quader(byval x1 as long, byval y1 as long, byval hx as long, byval hy as long) DrawCircle hdc, x1, y1, 3, &hFF0000DrawCircle hdc, x1,y1+hy,3,&hFF0000DrawCircle hdc, x1+hx,y1+hy,3,&hFF0000DrawCircle hdc, x1+hx, y1,3,&hFF0000DrawBox hdc, x1, y1, hx, hy,&h00FF00End Sub'-----------class button'===========long x0,y0,w0,h0string txtmethod constructor(byval px as long, byval py as long, byval pw as long, byval ph as long, byval tx as string) txt=tx : x0=px : y0=py : w0=pw : h0=ph iF Len(txt) > w0/10 Then txt ="!" draw()end methodmethod destructor()end methodmethod msg(t as string) txt=tend methodmethod draw() DrawRectangle hdc,x0,y0,w0,h0,255 DrawLine hdc,x0,y0,x0+w0,y0,&hFAFAFA DrawLine hdc,x0,y0,x0,y0+h0,&hFAFAFA DrawLine hdc,x0+w0,y0,x0+w0,y0+h0,&h404040 DrawLine hdc,x0,y0+h0,x0+w0,y0+h0,&h404040 DrawText hdc,txt,x0+5+(w0-Len(txt)*10)\2,y0+((h0-16)\2),&hFF0000end methodmethod pressed() as long iF MouseClick() =1 And MouseX >=x0 And MouseX <=x0+w0 And MouseY >=y0 And MouseY <=y0+h0 DrawLine hdc, x0,y0,x0+w0,y0,&h404040 DrawLine hdc, x0,y0,x0,y0+h0,&h404040 DrawLine hdc, x0+w0,y0,x0+w0,y0+h0,&hFAFAFA DrawLine hdc, x0,y0+h0,x0+w0,y0+h0,&hFAFAFA Function =1 End iFend methodend class new button ButtonA 32, 72, 68, 16,"Quader" new button ButtonB 32, 90, 68, 16,"Stop!" new button ButtonC 280,400,128,32,"Home"new Button ButtonD 280,68, 256,38,""While WinExit =0 ClearBuffer &h669ddbbuttonA.draw : buttonB.draw : buttonC.draw : buttonD.drawif buttonC.pressed then WinExit=1if buttonD.pressed then buttonD.msg "THANK YOU!" else buttonD.msg "BUTTON FOR YOU!"iF ButtonB.pressed Then clk=0 Quader mx,200,80,64DrawCircle hdc, px,py, a,&hFFFF00DrawCircle hdc, px,py+2,a,&hFFA000DrawCircle hdc, px,py-2,a,&hFF6400iF ButtonA.pressed Then clk=1 iF clk=1 iF a <=120 Then a += 1.0mx = mx +6iF mx >=640-8 Then mx=0End iFDoEventsFlipBuffer Delay (10)Wenddel buttonA : del buttonB : del buttonC : del buttonDWinEnd