Also ich hab den code von Crossroads getestet (den den er ganz am anfang gepostet hat) und der ging bei mir nicht. Ich hab ihn mal umgeschrieben und der hier geht bei mir ohne flimmern:
Code: Alles auswählen
InitSprite()
InitKeyboard()
InitMouse()
;- Bildschirmeinstellungen
OpenScreen(800, 600, 32, "Test")
ClearScreen(0,0,0)
#Speed = 0
;- Initsialisierung
LoadFont (0, "Courier New", 40,#PB_Font_Bold)
LoadFont (1, "Courier New", 14,#PB_Font_Bold)
;-Start
Gosub Startbildschirm
;-Tastatur
Repeat
ExamineKeyboard()
If KeyboardPushed(#PB_Key_F10): Gosub Balken: EndIf
Until KeyboardPushed(#PB_Key_Escape)
End
;--------------------------------------------------------------------------------------------------------------------------
;- Balken
Balken:
; FlipBuffers()
ClearScreen(0,0,0)
StartDrawing(ScreenOutput())
DrawingMode(1)
FrontColor(0, 0, 0): Box (3,3,793,593)
FrontColor(255,255,255): Box (97,97,606,106)
FrontColor(0,0,0): Box (100,100,600,100)
FrontColor(0,255,0):
DrawingFont(UseFont(1))
Locate (120,220): DrawText("Speed % = 000")
Locate (170,500): DrawText("ESC = Zurück")
Locate (170,300): DrawText("F3 = -")
Locate (170,330): DrawText("F4 = +")
StopDrawing()
FlipBuffers()
Repeat
ExamineKeyboard()
If KeyboardPushed(#PB_Key_F3): Gosub Minus: EndIf
If KeyboardPushed(#PB_Key_F4): Gosub Plus: EndIf
Until KeyboardPushed(#PB_Key_Escape)
Return
;- Minus
Minus:
speed = speed - 1
If speed <1 : speed = 1: EndIf
l = speed * 6
Gosub Anzeige
Return
;- Plus
Plus:
speed = speed +1
If speed >100 : speed = 100: EndIf
l = speed * 6
Gosub Anzeige
Return
;- Anzeige
Anzeige:
; FlipBuffers()
ClearScreen(0,0,0)
StartDrawing(ScreenOutput())
DrawingMode(1)
FrontColor(0, 0, 0): Box (3,3,793,593)
FrontColor(255,255,255): Box (97,97,606,106)
FrontColor(0,0,0): Box (100,100,600,100)
FrontColor(0,255,0):
DrawingFont(UseFont(1))
Locate (120,220): DrawText("Speed % = 000")
Locate (170,500): DrawText("ESC = Zurück")
Locate (170,300): DrawText("F3 = -")
Locate (170,330): DrawText("F4 = +")
FrontColor(0,0,0): Box (100,100,600,100)
Box (120,220,200,20)
FrontColor(0,0,255): Box (100,100,l,100)
FrontColor(0,255,0):
DrawingMode(1)
DrawingFont(UseFont(1))
Locate (120,220): DrawText("Speed % = "+Str(speed))
StopDrawing()
FlipBuffers()
Return
;- Startbildschirm
Startbildschirm:
StartDrawing(ScreenOutput())
DrawingMode(1):DrawingFont(UseFont(0))
FrontColor(90, 0, 255): Box (0,0,799,599)
FrontColor(0, 0, 0): Box (3,3,793,593)
FrontColor(90, 0, 255)
Locate (170,180)
DrawText("Hauptbildschirm")
DrawingFont(UseFont(1))
Locate (170,250): DrawText("F10 = Speed")
Locate (170,280): DrawText("ESC = Zurück")
StopDrawing()
FlipBuffers()
Return
End