what is an [in between pixel] ...

Just starting out? Need help? Post your questions and find answers here.
marc_256
Addict
Addict
Posts: 862
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

what is an [in between pixel] ...

Post 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
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
STARGÅTE
Addict
Addict
Posts: 2280
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

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

Post 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
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply