I made a small card game platform with Spiderbasic.
Since beta 2.40, some players have had a very strange map display.
The playing cards are slowly being "eaten"
Why can that be?
Strange display bug
Re: Strange display bug
Could you try to reproduce it in a small snippet ?
Re: Strange display bug
No, unfortunately not. I've tried Windows and Linux and all major browsers, I don't get the error.
However, the users who have the error have also tried it with all common browsers, Windows 10 and Windows 7.
However, the users who have the error have also tried it with all common browsers, Windows 10 and Windows 7.
Re: Strange display bug
Could it be due to Resizegadget()? Did you change something there?
-
- Posts: 284
- Joined: Fri Sep 22, 2017 7:02 am
Re: Strange display bug
Just to be sure, have you also updated the libraries?
Re: Strange display bug
I have tried the new and also the old libraries, all the same.
Re: Strange display bug
With this code, som people have problems.
Hold the Mousepounter over the "cards".
Hold the Mousepounter over the "cards".
Code: Select all
EnableExplicit
Declare MouseOverGadget(window, gadget)
Declare Kartenhoch()
Declare createCards()
Declare MoveGadget(gadget,x,y)
Declare TimerEvents()
Enumeration
#window
#TimerKartenHoch
EndEnumeration
Global Dim MyCardGadget(12)
Global MeineKartenY,MausAufKarteMerki
Procedure MouseOverGadget(window, gadget)
If (WindowMouseX(window) >= GadgetX(gadget)) And (WindowMouseX(window) < (GadgetX(gadget) + GadgetWidth(gadget)))
If (WindowMouseY(window) >= GadgetY(gadget)) And (WindowMouseY(window) < (GadgetY(gadget) + GadgetHeight(gadget)))
ProcedureReturn 1
EndIf
EndIf
EndProcedure
Procedure KartenHoch()
Protected i,k,merki,x,y,w,h,ok
Static mx_alt, my_alt
x = WindowMouseX(#window)
y = WindowMouseY(#window)
; Bei der hervergehobenen Karte testen, ob sich die Maus nicht wesentlich verschoben hat
; Ansonsten „flackern“ die Karten, wenn die Maus am unteren Rand einer Karte ist, diese hochgeschoben wird und dann die Karte dahinter plötzlich die unter der Maus ist.
If x >= mx_alt - 2 And x <= mx_alt + 2 And y >= my_alt - 2 And y <= my_alt + 2
ProcedureReturn
EndIf
mx_alt = x
my_alt = y
merki=0
For i=1 To 12
If MouseOverGadget(#window,MyCardGadget(i))>0
merki=i
EndIf
Next i
If merki>0 And merki<>MausAufKarteMerki
MausAufKarteMerki=merki
For k=1 To 12
If GadgetY(MyCardGadget(k))<>MeineKartenY And k<>merki
MoveGadget(MyCardGadget(k),#PB_Ignore,MeineKartenY)
EndIf
Next k
MoveGadget(MyCardGadget(merki),#PB_Ignore,MeineKartenY-10)
EndIf
;Mauszeige auf keiner Karte,
;alle Karten runtersetzen
If merki=0
For k=1 To 12
If GadgetY(MyCardGadget(k))<>MeineKartenY
MoveGadget(MyCardGadget(k),#PB_Ignore,MeineKartenY)
EndIf
Next k
EndIf
EndProcedure
Procedure createCards()
Protected i,pic,x,y,w,h
x=10
y=200
For i=1 To 12
pic=CreateImage(#PB_Any,50,100,32,RGB(Random(200),Random(200),Random(200)))
w=ImageWidth(pic)
h=ImageHeight(pic)
MyCardGadget(i)=ImageGadget(#PB_Any,x,y,w,h,ImageID(pic))
x+w
Next i
MeineKartenY=y
EndProcedure
Procedure MoveGadget(gadget,x,y)
ResizeGadget(gadget, x,y, #PB_Ignore, #PB_Ignore) ; Only move the gadget to a new position.
EndProcedure
Procedure TimerEvents()
If EventTimer()=#TimerKartenHoch
KartenHoch()
EndIf
EndProcedure
OpenWindow(#window,0,0,800,600,"Test")
createCards()
BindEvent(#PB_Event_Timer, @TimerEvents())
AddWindowTimer(#window, #TimerKartenHoch,100)
Re: Strange display bug
Having a gadget per card looks a bit wierd to me, may be you should switch to a CanvasGadget() and do al the drawing here.