Weiß nich obs sowas schonmal gab, aber ich hab mal so ein programmchen geschrieben, dass eine Stoppuhr darstellen soll. Der Code ist nicht sehr schlau programmiert und könnte wohl doppelt so klein sein ... ... aber egal:
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN] Graphics 640,480 AppTitle "Stoppuhr" SchriftA = LoadFont("Courier new", 40, 1,0,0) SchriftB = LoadFont("Courier new", 32, 0,0,0) .Beginn SetBuffer BackBuffer() Stoppzeit = 0 Start = 0 Repeat Cls Rect 170,190,255,100,0 Rect 170,170,50,20,1 Rect 375,170,50,20,1 SetFont SchriftA Text 200,220,"00:00" SetFont SchriftB Text 325,226, "000" Rect 170,190,255,100,0 Rect 170,170,50,20,1 Rect 375,170,50,20,1 MausX = MouseX() MausY = MouseY() If MausX > 169 And MausX < 221 And MausY > 169 And MausY < 191 Then Color 255,0,0 Rect 170,170,50,20,1 Color 255,255,255 If MouseHit(1) Then Start = 1 EndIf EndIf Flip Until Start = 1 Or KeyHit(1) Anfang = MilliSecs() .Hptschl Repeat FlushKeys Cls Zwischenzeit = MilliSecs() Spanne = (Zwischenzeit - Anfang)-Stoppzeit Tausendstel = Spanne - TBegrenzung Sekunden = (Spanne / 1000) - SBegrenzung Minuten = (Spanne / 1000) / 60 If Tausendstel > 999 Then TBegrenzung = TBegrenzung + 1000 If Sekunden > 59 Then SBegrenzung = SBegrenzung + 60 SetFont SchriftA Text 200,220, Replace$(RSet$(Minuten, 2), " ", 0) + ":" + Replace$(RSet$(Sekunden,2), " ", 0) SetFont SchriftB Text 325,226, Replace$(RSet$(Tausendstel, 3), " ", 0) Rect 170,190,255,100,0 Rect 170,170,50,20,1 Rect 375,170,50,20,1 MausX = MouseX() MausY = MouseY() If MausX > 169 And MausX < 221 And MausY > 169 And MausY < 191 Then Color 255,0,0 Rect 170,170,50,20,1 Color 255,255,255 If MouseHit(1) Then Goto Stopp EndIf If MausX > 374 And MausX < 426 And MausY > 169 And MausY < 191 Then Color 255,0,0 Rect 375,170,50,20,1 Color 255,255,255 If MouseHit(1) Then Goto Zwzeit EndIf Flip Until KeyHit(1) FlushKeys WaitKey() End .Stopp Stoppanfang = MilliSecs() Repeat Cls Stoppzwischenzeit = MilliSecs() SetFont SchriftA Text 200,220, Replace$(RSet$(Minuten, 2), " ", 0) + ":" + Replace$(RSet$(Sekunden,2), " ", 0) SetFont SchriftB Text 325,226, Replace$(RSet$(Tausendstel, 3), " ", 0) Rect 170,190,255,100,0 Rect 170,170,50,20,1 Rect 375,170,50,20,1 MausX = MouseX() MausY = MouseY() If MausX > 169 And MausX < 221 And MausY > 169 And MausY < 191 Then Color 255,0,0 Rect 170,170,50,20,1 Color 255,255,255 If MouseHit(1) Then Stoppzeit = Stoppzeit + (Stoppzwischenzeit - Stoppanfang) Goto Hptschl EndIf EndIf If MausX > 374 And MausX < 426 And MausY > 169 And MausY < 191 Then Color 255,0,0 Rect 375,170,50,20,1 Color 255,255,255 If MouseHit(1) Then Goto Beginn EndIf EndIf Flip Until KeyHit(1) .Zwzeit Repeat Cls SetFont SchriftA Text 200,220, Replace$(RSet$(Minuten, 2), " ", 0) + ":" + Replace$(RSet$(Sekunden,2), " ", 0) SetFont SchriftB Text 325,226, Replace$(RSet$(Tausendstel, 3), " ", 0) Rect 170,190,255,100,0 Rect 170,170,50,20,1 Rect 375,170,50,20,1 MausX = MouseX() MausY = MouseY() If MausX > 374 And MausX < 426 And MausY > 169 And MausY < 191 Then Color 255,0,0 Rect 375,170,50,20,1 Color 255,255,255 If MouseHit(1) Then Goto Hptschl EndIf Flip Until KeyHit(1)
|