Ich habe unten einen Screen für den Z1013 32x32 Zeichen, der auch schon funktioniert.
Zur Zeit werden nur die Buchstaben A und B dargestellt.
Nun möchte ich einen Buchstaben setzen bei einem Tastendruck , wenn ich die Taste trotzdem festhalte soll der gleich Buchstabe nicht dauernd gedruckt werden sondern nur einmal.
Wie geht das ?
Danke.
Gruss
peter
Code: Alles auswählen
Global color.l, r.c,g.c,b.c,z.c,xx.l,yy.l
Global ascii_daten.l, wert.c, wert1.c,anzahl.l,nr.l,spalte.l,zeile.l
Declare PixelArray()
Declare ascii_bin()
ascii_daten = AllocateMemory(2500)
InitSprite()
InitKeyboard()
OpenWindow(1,200,200,532,532,"test",#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(1),10,10,512,512,0,0,0)
anzahl=0
spalte=0
zeile=0
ascii_bin()
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
Case 0
ExamineKeyboard()
If KeyboardPushed(#PB_Key_A)
If spalte> 31
spalte=0
yy=yy+16
xx=0
zeile=zeile+1
If zeile > 31
ClearScreen(RGB(0,0,0))
zeile=0
yy=0
EndIf
EndIf
spalte=spalte+1
nr=65*8
pixelArray()
EndIf
If KeyboardPushed(#PB_Key_B)
If spalte> 31
spalte=0
yy=yy+16
xx=0
zeile=zeile+1
If zeile > 31
ClearScreen(RGB(0,0,0))
zeile=0
yy=0
EndIf
EndIf
spalte=spalte+1
nr=66*8
pixelArray()
EndIf
Delay(50)
EndSelect
ForEver
Procedure ascii_bin()
ReadFile(0,"d:\kc\kc-asm\zg_1013_orig.bin")
While Eof(0) = 0
wert= ReadByte(0)
PokeB(ascii_daten+anzahl,wert)
anzahl=anzahl+1
Wend
CloseFile(0)
EndProcedure
Procedure pixelArray()
FlipBuffers()
StartDrawing(ScreenOutput())
For y = 0 To 7
wert=PeekC(ascii_daten+y+nr)
For x = 2 To 16 Step 2
wert1=$80
wert=wert << 1
If wert1=wert & $80
Plot(x+xx,y*2+yy,RGB(255,255,255))
Plot(x+xx+1,y*2+yy,RGB(255,255,255))
Plot(x+xx,y*2+1+yy,RGB(255,255,255))
Plot(x+xx+1,y*2+1+yy,RGB(255,255,255))
EndIf
Next x
Next y
StopDrawing()
xx=xx+16
EndProcedure