Glitches in 2d
Posted: Wed Jan 24, 2024 6:17 pm
The mouse pointer and coordinates are displayed on the screen, but the mouse slows down frame by frame, everything moves, if you remove DrawText then everything becomes normal! More precisely, it’s StartDrawing(ScreenOutput()). If you remove this command, everything works without lags. System Linux Ubuntu
What could be the problem?
What could be the problem?
Code: Select all
Enumeration
#MouseSprite
EndEnumeration
If Not InitSprite() Or Not InitMouse() Or Not InitKeyboard() Or Not OpenScreen(1920,1080,32,"")
End
EndIf
UsePNGImageDecoder()
LoadSprite(#MouseSprite,"images/cursor3.png",#PB_Sprite_AlphaBlending)
ZoomSprite(#MouseSprite,32,32)
TransparentSpriteColor(#MouseSprite,RGB( 0, 0, 0))
Repeat
ClearScreen(RGB(0,0,0))
ExamineMouse()
ExamineKeyboard()
mousex=MouseX()
mousey=MouseY()
DisplayTransparentSprite(#MouseSprite,mousex,mousey)
StartDrawing(ScreenOutput())
DrawText(0,10, "X=" + Str(MouseX), RGB(255,255,255))
DrawText(0,60, "Y=" + Str(MouseY), RGB(255,255,255))
StopDrawing()
If KeyboardPushed(#PB_Key_Escape)
End
EndIf
FlipBuffers()
ForEver