Ricky Posted July 12, 2019 Share Posted July 12, 2019 Another (i don't know if it's stupid) question. My project work fine on desktop and mobile except portrait mode ?? For example, on samsung S6 the footer object it's well positioned, but not on big screen like iphone XS or S8 I'm using coordinate *.position.x or position.y to move this container, but what is the best practice to implement it? I mean, it's not like website with align top or align bottom Thanks for your reply Quote Link to comment Share on other sites More sharing options...
Exca Posted July 12, 2019 Share Posted July 12, 2019 You could adjust the pivot or anchor points to change how object aligns. For example to align a sprite to the middle & bottom of the screen you could say: sprite.anchor.set(0.5, 1); sprite.x = renderer.screen.width/2; sprite.y = renderer.screen.height; Without seeing the exact problem it's hard to say what is the correct way to fix it. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 12, 2019 Share Posted July 12, 2019 Its not stupid, and portait mode is tricky because you have to resize renderer accordingly. I'm sorry i cant help with that right now , but i'll post here if I see older issue where it was solved. Quote Link to comment Share on other sites More sharing options...
Ricky Posted July 13, 2019 Author Share Posted July 13, 2019 is there some way to convert position value in pixel? For example i know what is the dimension of screen in pixel, i could convert this value in "pixi unit", so moving y value is it a wrong idea? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 13, 2019 Share Posted July 13, 2019 look, there are two approaches: 1. fix canvas size like in https://github.com/ivanpopelyshev/pixi-starfighter/ , please clone it and try 2. resize canvas that way pixi pixel is the same as screen BUT change `stage.scale` that way your stage fits the screen. In local coords of that stage you can use your units. Try both approaches, then take pen and paper and try to understand how it works and what does suit you. Quote Link to comment Share on other sites More sharing options...
Ricky Posted July 25, 2019 Author Share Posted July 25, 2019 Solved all, thanks guy ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 25, 2019 Share Posted July 25, 2019 @Ricky yo, so, which one did you use? Quote Link to comment Share on other sites More sharing options...
Ricky Posted July 25, 2019 Author Share Posted July 25, 2019 i used the second option refactoring all containers an resizing stage. it fit perfectly on every browser thanks guy ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.