Jump to content

Search the Community

Showing results for tags 'ascpect ratio'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. var Container = PIXI.Container, loader = PIXI.loader, Sprite = PIXI.Sprite, resources = PIXI.loader.resources;var renderer = PIXI.autoDetectRenderer(256, 256);document.body.appendChild(renderer.view);var stage = new Container();renderer.backgroundColor = 0xffffff;renderer.render(stage);loader .add("images/ant.png") .on("progress", loadProgressHandler) .load(setup);function loadProgressHandler(loader, resource) { console.log(loader.progress);}var ant;function setup() { ant = new Sprite.fromImage("images/ant.png"); stage.addChild(ant); renderer.render(stage); renderer.view.style.position = "absolute" renderer.view.style.width = window.innerWidth + "px"; renderer.view.style.height = window.innerHeight + "px"; renderer.view.style.display = "block"; gameLoop();}function gameLoop() { requestAnimationFrame(gameLoop); renderer.render(stage);}This is how my game.js script actually looks like and so far I'm quite happy with what it's doing. But my problem is that all sprites I render on my canvas are distorted and do not keep their original sizes. So what am I doing wrong here? I just want to keep the original sizes of all objects I'll render on the canvas. (The ant.png image is 250x250px) How the result looks like: How the ant.png looks like:
×
×
  • Create New...