valentinaCom Posted November 5, 2014 Share Posted November 5, 2014 Hi So I have in my phaser game a text element (DOM).When I set the scale mode of my game to SHOW_ALL and set it to fit the screen size, my canvas changes perfectly but the html element doesn't. I am trying for a while now to change the element scale according to my phaser canvas scale so the text will always stay at the position I want it to be and it's size to fit too, however, I can't find how to do it.Of course, I need to the font size to change too. any help? Thank you Link to comment Share on other sites More sharing options...
Skeptron Posted November 5, 2014 Share Posted November 5, 2014 I guess you have good motives not to directly integrate your text as a Phaser text component, but obviously it makes things harder. However I think you could use plain javascript or even Jquery to listen to the window-resizing event and modify your text dimensions when triggered : $(window).resize(function(){window.resizeGame();});function resizeGame() { // Refresh the game size game.scale.setShowAll(); game.scale.refresh(); // Resize your DOM elements here} Link to comment Share on other sites More sharing options...
Recommended Posts