[oden] Move scaling entirely into JavaScript
Now the game controls its own resolution. We might want to further copy Love2D and generate resize events, I don't know.
This commit is contained in:
parent
994be3e493
commit
1cb30034f8
9 changed files with 176 additions and 58 deletions
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
struct ScreenUniform {
|
||||
resolution : vec2f,
|
||||
zoom : vec2f,
|
||||
};
|
||||
@group(0) @binding(0) // 1.
|
||||
var<uniform> screen : ScreenUniform;
|
||||
|
|
@ -20,7 +19,7 @@ fn adjust_for_resolution(in_pos: vec2<f32>) -> vec2<f32> {
|
|||
//
|
||||
// Put result in the range [0-2], where (2,2) is the bottom-right corner
|
||||
// of the screen.
|
||||
var result = (in_pos * screen.zoom * 2.0) / screen.resolution;
|
||||
var result = (in_pos * 2.0) / screen.resolution;
|
||||
|
||||
// Put result in the range [-1,1] where [1,1] is the bottom-right corner
|
||||
// of the screen.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue