ich konnte mich eine ganze Weile nicht mehr mit PB beschäftigen. Bisher habe ich immer die 5.72 LTS benutzt.
Ich habe jetzt die 6.03 geladen, und ein neues Projekt mit meinem Programmgerüst angefangen, welches bisher immer einwandfrei funktioniert hat. Jetzt stimmt etwas mit der Darstellung auf dem Screen nicht mehr. Irgendwie scheint das FlipBuffers nicht mehr zu funktionieren.
Das unten stehende Programm funktioniert unter 5.72 aber nicht unter 6.0.
Bisher war es so: => startDrawing(Ausgabeziel) => Zeichenoperationen => stopDrawing() und =>FlipBuffers()
Dann wurde jeweils auf dem vorhandenen Screen die Änderung angezeigt. Jetzt ist der alte Screen auf einmal weg und nur die Änderungen werden angzeigt um im nächsten Screen wieder das vorherige Hintergrundbild wieder anzuzeigen. Ich verstehe das nicht.
Es wäre nett wenn mir eine der Koryphäen hier sagen könnte wo mein Fehler steckt.
Ich bedanke mich im voraus.
Code: Alles auswählen
; ============================================================
; Faltung schalten <F4> alle Faltungen schalten <strg><F4>
;-{-AA_INIT ---------------------------------------------------
AA_INIT:
EnableExplicit
;zusätzliche Bibliothek laden
UseJPEGImageDecoder()
;UseJPEGImageEncoder()
UsePNGImageDecoder()
;} ----------------------------------------------------------
;-{-AB_Prozeduren_anmelden ------------------------------------
;Prozeduren anmelden
Declare MELDAUTOR()
Declare MELDUNTEN(meldu$)
Declare MELDULOESCH()
Declare ZE_HIGRU()
Declare WAITACTION()
Declare AUTOR()
Declare SYS_FARBE()
Declare SYS_BILDER()
Declare ZE_ROHBILD()
Declare ZE_STATISTIK()
Declare SYS_ZEIT()
Declare ZE_ZEIT(zeit$)
Declare ZE_SCORE(score$)
Declare SYS_ACTION(nr,event)
Declare ALPHAIMAGE()
;} -----------------------------------------------------------
;-{-AC_Variablendeklarationen ---------------------------------
;Variablendeklarationen
Enumeration ; bilder
#bld00
#bld01
#bld02
#bld03
#bld04
#bld05
; Auswahlbilder
#bld31
#bld32
#bld33
#bld34
#bld67
EndEnumeration
Enumeration ; Fonts
#font00
#font01
#font02
#font03
#font04
#font05
#font06
#font07
#font08
#font09
EndEnumeration
#TITEL$="Titel"
#HBLD$="Titel.jpg"
#ICON$="Titel.ico"
#AUTOR$="Autor"
#xadd = 2
#yadd = 2
#klotz=30
#win1=1 ; ID des benutzten Fensters
#win1_x=1280 ; Fenstergrösse x (0-1219)
#win1_y=720 ; fenstergrösse y (0-719)
Global Dim gg(40) ; globale Variablen
Global Dim fa(40) ; Farbdefinitionen
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Global taste,mod_s,mod_c,timanfang
taste=0 ; gedrückte Taste in Verbindung mit
; Modifiern; shift=1000, alt=2000; ctrl=4000
Define dummy,q,event
Define tt$
;} -------------------------------------------------------------
;-{-AD_Schriften laden ----------------------------------------
; Windows 10 Standardschriften:
; Arial(p), Bahnschrift(p), Calibri(p), Cambria(p), Georgia(p), Times New Roman(p)
; Consolas(m), CourierNew(m), Lucida Console(m)
LoadFont(#font01,"Georgia",18,#PB_Font_Bold ) ;proportional (meldautor,meldunten)
LoadFont(#font06,"Lucida Console",12) ;monospace
LoadFont(#font07,"Lucida Console",18,#PB_Font_Bold);monospace
LoadFont(#font08,"Lucida Console",24,#PB_Font_Bold);monospace
;} ----------------------------------------------------------
;-{-AE_Hauptfenster öffnen ------------------------------------
;Openwindow mit windowed screen
; =============================
If InitSprite()=0
MessageRequester("Fehler","Sprite-System kann nicht geöffnet werden", 0)
End
EndIf
If InitKeyboard() = 0
MessageRequester("Fehler","Keyboard kann nicht geöffnet werden", 0)
End
EndIf
If InitMouse()=0
MessageRequester("Fehler","Maus kann nicht aktiviert werden",0)
End
EndIf
OpenWindow(#win1,0,0,#win1_x,#win1_y,#titel$,#PB_Window_SystemMenu | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#win1),0,0,#win1_x,#win1_y,#True,0,0)
SetFrameRate(50)
SYS_FARBE()
SYS_BILDER() ;Bilder initialisieren
;} -------------------------------------------------------------
; ============================================================
;-{-BA_VORSPIEL -----------------------------------------------
BA_VORSPIEL:
ClearScreen(RGB(0,0,0))
;} -----------------------------------------------------------
;-{-BB_ANFANG -------------------------------------------------
BB_ANFANG:
ZE_HIGRU()
Meldunten("Hintergrundbild")
taste=Waitaction()
MELDAUTOR()
taste=Waitaction()
MELDULOESCH()
taste=Waitaction()
ZE_ROHBILD()
MELDUNTEN("Jetzt geht's los <Taste druecken>")
taste=0:taste=WAITACTION()
If taste=27:EndIf
MELDULOESCH()
End
;} -----------------------------------------------------------
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure SYS_ACTION(nr,event)
Select event
; Tastatur-Operationen ---------------------------------------
; ; keydown wird nur bei Modifizierern shift (16) und Control (17) beachtet
; Case #WM_KEYDOWN
; Select EventwParam()
; Case 16
; mod_s=1000
; If EventlParam()>3000000:mod_s=1300:EndIf
; ; Debug "#KEYDOWN: W " + Str(EventwParam())
; Case 17
; mod_c=2000
; If EventlParam()>3000000:mod_c=2400:EndIf
; ; Debug "#KEYDOWN: W " + Str(EventwParam())
; EndSelect
;
Case #WM_KEYUP
taste=EventwParam()
; 27=esc; 37=li; 38=up; 39=re; 40=dn; 65=a; 74=j; 78=n; 83=s; 89=y
EndSelect
If taste=27:gg(1)=9:EndIf
If nr=1 And taste<>27 :taste=0:EndIf
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure WAITACTION()
Protected event
Repeat
Event = WindowEvent()
If event
SYS_ACTION(2,event)
Else
Delay(5)
EndIf
Until taste>0
Delay(120)
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure MELDAUTOR()
StartDrawing(ScreenOutput())
FrontColor(fa(4)):Box (0,690,240,30)
FrontColor(fa(2)):Box (1,691,238,28)
FrontColor(fa(4)):Box (1040,690,240,30)
FrontColor(fa(2)):Box (1041,691,238,28)
DrawingFont(FontID(#font01)):DrawingMode(1)
DrawText(15,692,#titel$,fa(4))
DrawText(14,691,#titel$,fa(6))
DrawText(1055,692,#autor$,fa(4))
DrawText(1054,691,#autor$,fa(6))
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure MELDULOESCH()
; MELDAUTOR()
StartDrawing(ScreenOutput())
FrontColor(fa(4)):Box (239,690,802, 30)
FrontColor(fa(2)):Box (240,691,800, 28)
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure MELDUNTEN(meldu$)
Protected txend,abzug
StartDrawing(ScreenOutput())
FrontColor(fa(4)):Box (239,690,802, 30)
FrontColor(fa(1)):Box (240,691,800, 28)
DrawingFont(FontID(#font01)):DrawingMode(1)
txend=DrawText(282,690,meldu$,fa(1))
abzug=(txend-282)/2
DrawText(640-abzug,692,meldu$,fa(4))
DrawText(640-abzug,691,meldu$,fa(6))
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure SYS_FARBE()
Fa( 1)= RGB(185,015,000) ; rot für meldunten
Fa( 2)= RGB(090,100,010) ; olivgruen f. meldautor
Fa( 3)= RGB(030,030,180) ; mittelblau als Hintergrund f. Meldtast
Fa( 4)= RGB(000,000,000) ; schwarz
Fa( 5)= RGB(255,255,255) ; hellweiss
Fa( 6)= RGB(255,255,000) ; gelb
Fa( 7)= RGB(255,000,000) ; rot
Fa( 8)= RGB(080,080,080) ; grau
Fa( 9)= RGB(165,005,000) ; farbe 2 für meldunten
; ab hier frei programmierbare Farben für spezifisches Prog
Fa(21)= RGB(000,000,100) ; dunkelblau
Fa(22)= RGB(060,130,060) ; gruen
Fa(23)= RGB(005,070,005) ; dunkelgruen
Fa(24)= RGB(075,060,000) ; braun
Fa(25)= RGB(130,120,000) ; beige
Fa(26)= RGB(100,150,240) ; hellblau
Fa(27)= RGB(250,040,040) ; hellrot
Fa(28)= RGB(140,010,010) ; dunkelrot
Fa(29)= RGB(030,030,030) ; dunkelgrau
Fa(30)= RGB(250,250,250) ; hellweiss
Fa(31)= RGB(100,250,100) ; knatschgruen
Fa(32)= RGB(250,040,040) ; frei
Fa(33)= RGB(250,040,040) ; frei
Fa(34)= RGB(140,010,010) ; frei
Fa(35)= RGB(180,180,180) ; hellgrau; Menu
Fa(36)= RGB(140,140,140) ; mittelgrau Menu
Fa(37)= RGB(160,180,200) ; hellgrau mit blau; Untermneues
Fa(38)= RGB(120,140,160) ; mittelgrau mit blau; Untermenues
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure SYS_BILDER()
; jetzt soll das Hintergrundbild geladen werden
; ---
; hier wird das Bild aus der EXE ausgelesen, in die es integriert ist
;CatchImage(#bld00,?zz_BILD01)
CreateImage(#bld00,1280,720)
StartDrawing(ImageOutput(#bld00))
Box(0,0,1280,720,fa(6))
StopDrawing()
FlipBuffers()
; bilder erstellen für meldunten und meldtast
GrabImage(#bld00,#bld01, 0, 704, 1024, 32) ;meldunten
GrabImage(#bld00,#bld02, 0, 672, 1024, 32) ;meldtast
; ----------------------------------------
; jetzt werden die Bilder für die Auswahlliste generiert
; ----------------------------------------
; Treppchen oben
CreateImage(#bld31,120,120)
StartDrawing(ImageOutput(#bld31))
Box(0,0,120,120,fa(4))
Box(1,1,118,118,fa(8))
Box(49,26,23,23,fa(4))
Box(50,27,21,21,fa(35))
Box(26,49,23,23,fa(4))
Box(27,50,21,21,fa(35))
Box(49,49,23,23,fa(4))
Box(50,50,21,21,fa(35))
Box(72,49,23,23,fa(4))
Box(73,50,21,21,fa(35))
StopDrawing()
FlipBuffers()
; Treppchen rechts
CreateImage(#bld32,120,120)
StartDrawing(ImageOutput(#bld32))
Box(0,0,120,120,fa(4))
Box(1,1,118,118,fa(8))
Box(49,26,23,23,fa(4))
Box(50,27,21,21,fa(35))
Box(49,49,23,23,fa(4))
Box(50,50,21,21,fa(35))
Box(49,72,23,23,fa(4))
Box(50,73,21,21,fa(35))
Box(72,49,23,23,fa(4))
Box(73,50,21,21,fa(35))
StopDrawing()
FlipBuffers()
; Treppchen unten
CreateImage(#bld33,120,120)
StartDrawing(ImageOutput(#bld33))
Box(0,0,120,120,fa(4))
Box(1,1,118,118,fa(8))
Box(26,49,23,23,fa(4))
Box(27,50,21,21,fa(35))
Box(49,49,23,23,fa(4))
Box(50,50,21,21,fa(35))
Box(72,49,23,23,fa(4))
Box(73,50,21,21,fa(35))
Box(49,72,23,23,fa(4))
Box(50,73,21,21,fa(35))
StopDrawing()
FlipBuffers()
; Treppchen links
CreateImage(#bld34,120,120)
StartDrawing(ImageOutput(#bld34))
Box(0,0,120,120,fa(4))
Box(1,1,118,118,fa(8))
Box(26,49,23,23,fa(4))
Box(27,50,21,21,fa(35))
Box(49,26,23,23,fa(4))
Box(50,27,21,21,fa(35))
Box(49,49,23,23,fa(4))
Box(50,50,21,21,fa(35))
Box(49,72,23,23,fa(4))
Box(50,73,21,21,fa(35))
StopDrawing()
FlipBuffers()
; ---
CreateImage(#bld67,120,120)
StartDrawing(ImageOutput(#bld67))
Box(0,0,120,120,fa(4))
Box(1,1,118,118,fa(8))
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure ZE_ZEIT(zeit$)
; Spieldauer anzeigen
StartDrawing(ScreenOutput())
Box (1080,600,180,50,fa(4))
Box (1081,601,178,48,fa(3))
DrawingFont(FontID(#font08))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(1087,613,zeit$,fa(4))
DrawText(1088,612,zeit$,fa(6))
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure ZE_HIGRU()
StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Default)
DrawImage(ImageID(#bld00),0,0)
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure ZE_SCORE(score$)
; Score anzeigen
StartDrawing(ScreenOutput())
Box (1080,540,180,50,fa(4))
Box (1081,541,178,48,fa(3))
DrawingFont(FontID(#font08))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(1087,553,score$,fa(4))
DrawText(1088,552,score$,fa(6))
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure ZE_STATISTIK()
Protected x,y,wert$
StartDrawing(ScreenOutput())
DrawingFont(FontID(#font06))
DrawingMode(#PB_2DDrawing_Transparent)
wert$="000"
x= 95
y= 15:DrawImage(ImageID(#bld67),x,y,80,80)
DrawText(x+15,y+30,wert$,fa(35))
y= 95:DrawImage(ImageID(#bld67),x,y,80,80)
DrawText(x+15,y+30,wert$,fa(35))
y=175:DrawImage(ImageID(#bld67),x,y,80,80)
DrawText(x+15,y+30,wert$,fa(35))
x=260
y= 15:DrawImage(ImageID(#bld67),x,y,80,80)
DrawText(x+15,y+30,wert$,fa(35))
y= 95:DrawImage(ImageID(#bld67),x,y,80,80)
DrawText(x+15,y+30,wert$,fa(35))
y=175:DrawImage(ImageID(#bld67),x,y,80,80)
DrawText(x+15,y+30,wert$,fa(35))
StopDrawing()
FlipBuffers()
EndProcedure
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Procedure ZE_ROHBILD()
Protected qx,qy,x,y
StartDrawing(ScreenOutput())
;Bereich 1: Spielfeld
Box(400,10,490,490,fa( 4))
Box(401,11,488,488,fa(35))
For qy=0 To 9
For qx=0 To 9
x=qx*48+405
y=qy*48+15
Box(x,y,48,48,fa(29))
Box(x+1,y+1,46,46,fa(8))
Next qx
Next qy
;Bereich 2: Nächste Steine
Box(400,520,490,130,fa( 4))
Box(401,521,488,128,fa(35))
For qx=0 To 3
x=qx*120+405
y=525
Box(x,y,120,120,fa(29))
Box(x+1,y+1,118,118,fa(8))
Next qx
; Bereich 3: statistik
Box(10,10,335,570,fa( 4))
Box(11,11,333,568,fa(35))
For qy=0 To 6
x=95:y=qy*80+15
DrawImage(ImageID(#bld67),x,y,80,80)
x=260
DrawImage(ImageID(#bld67),x,y,80,80)
Next qy
x=15
y= 15:DrawImage(ImageID(#bld31),x,y,80,80)
y= 95:DrawImage(ImageID(#bld32),x,y,80,80)
y=175:DrawImage(ImageID(#bld33),x,y,80,80)
x=180
y= 15:DrawImage(ImageID(#bld34),x,y,80,80)
y= 95:DrawImage(ImageID(#bld33),x,y,80,80)
y=175:DrawImage(ImageID(#bld32),x,y,80,80)
DrawImage(ImageID(#bld31),405,525)
DrawImage(ImageID(#bld33),525,525)
DrawImage(ImageID(#bld34),645,525)
DrawImage(ImageID(#bld32),765,525)
StopDrawing()
FlipBuffers()
meldautor()
MELDUNTEN("1 nach Rohbild")
taste=waitaction()
melduloesch()
ZE_Score(" 2450 ")
MELDUNTEN("2 nach Rohbild, Score ")
taste=waitaction()
melduloesch()
MELDUNTEN("3 nach Rohbild, Zeit ")
ZE_Zeit("00:00:00")
taste=waitaction()
ZE_STATISTIK()
melduloesch()
MELDUNTEN("4 nach Rohbild, Statistik ")
; Delay(5000)
taste=waitaction()
EndProcedure
End