Page 1 of 1

Glitches in 2d

Posted: Wed Jan 24, 2024 6:17 pm
by rndrei
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?

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

Re: Glitches in 2d

Posted: Wed Jan 24, 2024 8:35 pm
by infratec
Hm ...

in windows it simply works.

Btw.: I used

Code: Select all

CreateSprite(#MouseSprite, 32, 32)
If StartDrawing(SpriteOutput(#MouseSprite))
  Circle(16, 16, 16, #Red)
  StopDrawing()
EndIf

Re: Glitches in 2d

Posted: Wed Jan 24, 2024 8:54 pm
by rndrei
I figured it out, I had to install the latest drivers for the video card, the topic can be closed!