Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small bugfix in roundPixels so it now also works smoothly with hires enabled #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Info**
- OS: [e.g. Windows]
- Version: [e.g. 1.5.0]

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
4 changes: 2 additions & 2 deletions src/engine/renderer/fastcontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ game.createClass('FastContainer', 'Container', {
var y = cwt.ty * game.scale;

if (game.Renderer.roundPixels) {
x = x | 0;
y = y | 0;
tx = Math.round(tx * game.scale)/game.scale;
ty = Math.round(ty * game.scale)/game.scale;
}

context.setTransform(cwt.a, cwt.b, cwt.c, cwt.d, x, y);
Expand Down
14 changes: 7 additions & 7 deletions src/engine/renderer/sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ game.createClass('Sprite', 'Container', {

this._tintColor = color;
this._tintAlpha = alpha || 1;

context.fillStyle = this._tintColor.substr(0, 7);
context.globalAlpha = this._tintAlpha;
var x = this.tintCrop.x * game.scale;
Expand Down Expand Up @@ -193,7 +193,7 @@ game.createClass('Sprite', 'Container', {
if (!this.texture.height && this.texture.baseTexture.height) {
this.texture.height = this.texture.baseTexture.height;
}

if (!this.texture.width || !this.texture.height) return true;

if (this.tint && !this._tintedTexture && !this._tintedTextureGenerated && this.tintAlpha > 0) {
Expand All @@ -208,18 +208,18 @@ game.createClass('Sprite', 'Container', {
else if (!this.tint && this._tintedTexture || this.tintAlpha === 0 && this._tintedTexture) {
this._destroyTintedTexture();
}

context.globalCompositeOperation = this.blendMode;
context.globalAlpha = this._worldAlpha;

var t = this._tintedTexture || this.texture;
var wt = transform || this._worldTransform;
var tx = wt.tx;
var ty = wt.ty;

if (game.Renderer.roundPixels) {
tx = tx | 0;
ty = ty | 0;
tx = Math.round(tx * game.scale)/game.scale;
ty = Math.round(ty * game.scale)/game.scale;
}

tx *= game.scale;
Expand Down Expand Up @@ -291,7 +291,7 @@ game.addAttributes('Sprite', {
@private
**/
_tintedTextures: [],

/**
@method _clearTintedTextures
@static
Expand Down