Page 1 of 1

what is an [in between pixel] ...

Posted: Tue Jan 06, 2026 10:44 pm
by marc_256
hello,

i'm programming basic now for about 45 years, but ...

in this post,
viewtopic.php?p=649766#p649766
Fred wrote: Tue Jan 06, 2026 12:51 pm It's just the type of the parameters which changed to floats, that's why you have an error now (to allow in between pixels display)
Q)
- what is an in between pixel ?
- and what is the purpose of that ?


thanks,
marc

Re: what is an [in between pixel] ...

Posted: Tue Jan 06, 2026 10:59 pm
by STARGĂ…TE
Here you can see the effect of floats for DisplaySprite:
The top image has a smooth move to the right,
while the bottom image makes a step movement.

Code: Select all

InitSprite()

Enumeration
	#Window
	#Sprite
EndEnumeration

OpenWindow(#Window, 0, 0, 300, 300, "Sprite", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0)
SpriteQuality(#PB_Sprite_BilinearFiltering)

CreateSprite(#Sprite, 32, 32)
StartDrawing(SpriteOutput(#Sprite))
	Box(10, 1, 2, 30, $FF8080)
	Box(16, 1, 2, 30, $80FF80)
	Box(22, 1, 2, 30, $8080FF)
	Line(1, 16, 30, 1, $FFFFFF)
StopDrawing()

Define Start = ElapsedMilliseconds()
Define X.f

Repeat
	
	Repeat
		
		Select WindowEvent()
			Case #PB_Event_CloseWindow
				End
			Case #Null
				Break
		EndSelect
		
	ForEver
	
	ClearScreen(0)
	
	X = 50+(ElapsedMilliseconds()-Start)/500
	
	DisplaySprite(#Sprite, X, 50)
	DisplaySprite(#Sprite, Int(X), 100)
	
	FlipBuffers()
	
ForEver