Snap to pixels

Monkey Forums/Monkey Programming/Snap to pixels

lom(Posted 2014) [#1]
I'm trying to achieve a pixel perfect drawings with float values. Here's what I'm doing:
Field x:float

Method OnUpdate()
x=x+1.3
End

Method OnRender()
DrawImage sprite,int(x),0
End

Is it correct? Or maybe Monkey has some kind of global switch to achieve this?


Gerry Quinn(Posted 2014) [#2]
It should be correct, I think - but check how it actually works on all target platforms, Monkey is about as cross-platform as possible, but you can never be 100% certain how graphics will appear, and they may have to be massaged slightly to get them perfect.


Hezkore(Posted 2014) [#3]
That's usually how I do it and it has so far worked on all targets.