It looks like you're new here. If you want to get involved, click one of these buttons!
saeys
Member
devicewidth = application:getDeviceHeight() deviceheight = application:getDeviceWidth() dx = application:getLogicalTranslateX() / application:getLogicalScaleX() dy = application:getLogicalTranslateY() / application:getLogicalScaleY() local blacksquare = Bitmap.new(Texture.new("images/blacksquare.png", true)) blacksquare:setAnchorPoint(0.5, 0.5) blacksquare:setPosition(-dx + devicewidth, -dy + deviceheight) |
Comments
If that is what you want here is the code I wrote for you.
first of all I replaced the deviceWidth and deviceHeight with getContentWidth and getContentHeight.
And because you use anchor point (0.5,0.5) you should subtract the half of your sprites width and height.
those are the other corner positions
Upper left corner:
I thought getDeviceHeight() would seem to help, at least as I understand the reference, but apparently it returns different results in output and on the screen. Does anyone know the practical use of getDeviceHeight/Width?
You could make a wrapper to setPosition function, or make your own, setUnits function which takes into consideration dx and dy values, like from -dx and -dy to contentWidth+dx and contentHeight+dy
What about getDeviceHeight() and getDeviceWidth? Any usability examples on that?