Comments (6)
I think I understand, the pointer position is incorrect? This is caused by my code for proper scaling, but you haven't implemented it on your UI.
You need to resize the canvas so that the CSS width/height are the real width/height on the page, but the width/height HTML attributes are the width/height used by the WASM application.
var elementWidth = 960;
var elementHeight = 720;
canvas.style.setProperty("width", elementWidth + "px", "important");
canvas.style.setProperty("height", elementHeight + "px", "important");
canvas.width = elementWidth * window.devicePixelRatio;
canvas.height = elementHeight * window.devicePixelRatio;
This code will also make the image a lot clearer.
from webretro.
nono,i need a bigest "canvas".
The larger the canvas, the clearer the image.
can you open the retroarch.nenge.net
using f12 console,moble mode.
click "open" the "psx"
clixk "test" to start
from webretro.
Larger canvas doesn't mean clearer image. The code I sent adjusted the internal dimensions of the canvas so that the canvas would stay the same size but the image would become clear.
Here is a more updated method that should work for you:
function adjustCanvasSize(width, height) {
canvas.style.setProperty("width", width + "px", "important");
canvas.style.setProperty("height", height + "px", "important");
var dpr = window.devicePixelRatio || 1;
if (Module && Module.setCanvasSize) {
Module.setCanvasSize(width * dpr, height * dpr);
} else {
canvas.width = width * dpr;
canvas.height = height * dpr;
}
}
adjustCanvasSize(960, 720);
// optionally attach this to a window resize event listener
from webretro.
adjustCanvasSize is like my code.nothing change.
if using style transform scale is not need hack js.
but this one will add top:-xxx;left:-xxx;
from webretro.
You shouldn't use style transform scale, using different CSS dimensions and HTML attribute dimensions is not a hacky thing to do.
from webretro.
Can I close this issue now?
from webretro.
Related Issues (20)
- how do i fast forward? HOT 2
- Major performance increase Audio Fixes HOT 4
- Project Status HOT 3
- States HOT 2
- 6.5.1 ideas HOT 1
- Embedding HOT 25
- suggestion: make a separate repo for 6.4 HOT 3
- Question HOT 5
- How do you save changes on the app? HOT 2
- How would I go about making a citra file? HOT 1
- Speed Up/Frame Throttle Not Working
- Sonic colors HOT 12
- question
- Will you add a xbox 360 core??? HOT 3
- Question HOT 2
- Building Core
- Error 0 HOT 4
- HOW DO I SAVE MY SETTINGS AHHH HOT 1
- Load local/server PSX BIOS file? HOT 1
- Stuck on loading screen each time I insert a rom HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webretro.