Glitches in 2d

Just starting out? Need help? Post your questions and find answers here.
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 185
Joined: Thu Dec 28, 2023 9:04 pm

Glitches in 2d

Post 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
infratec
Always Here
Always Here
Posts: 7664
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Glitches in 2d

Post 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
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 185
Joined: Thu Dec 28, 2023 9:04 pm

Re: Glitches in 2d

Post by rndrei »

I figured it out, I had to install the latest drivers for the video card, the topic can be closed!
Post Reply