Comments (8)
Content position is set so that you know where the content's left bottom position is in the viewport. It is not being used, because scale modes need only scale factor to be calculated and then applied to the scene.
from ouzel.
So it is the viewport that actually gets centered? I don't see that implemented in the code either ... Maybe I missed it somehow?
from ouzel.
This is the line that creates the scaled orthographic matrix: https://github.com/elnormous/ouzel/blob/master/ouzel/scene/Camera.cpp#L91
from ouzel.
I fully understand this orthographic matrix. However when I use the engine, say with an example device screen size of 1200x1920, and targetContentSize of 600x800, the contentScale is correctly set to 2. But when I try to draw a 600x800 sprite at position (0, 0), it is drawn on the bottom left corner of the device screen. I am expecting it being drawn vertically centered on the screen, WITHOUT manually setting the position, hence the question.
from ouzel.
Device: 1200x1920
+------+
| |
+------+
+sprite|
|------+
| |
+------+
targetContentSize: 600x800
draw sprite of size (600x800) at (0, 0)
Expected
+------+
| |
+------+
+sprite|
|------+
| |
+------+
Actual
+------+
| |
| |
| |
+------+
+sprite|
|------+
from ouzel.
What scale mode are you using? Can you please post your code somewhere?
from ouzel.
nothing special here. Basically it boils down to
videoLayer = new Layer ()
videoCamera = new Camera ('show-all');
videoCamera.setTargetContentSize (600, 400);
videoLayer.addCamera (videoCamera);
addLayer (videoLayer);
videoSprite = new Sprite (600, 400);
videoNode = new Node ();
videoNode.setPosition (0, 0);
videoNode.addComponent (videoSprite);
videoLayer.addChild (videoNode);
from ouzel.
Ah.. I see. Ouzel has center of the screen as the origin, whereas I'm assuming the bottom-left corner.. How interesting..
from ouzel.
Related Issues (20)
- Erroneous declaration of functions in the class SoundData HOT 5
- A lot of reallocations in vector assign a data. HOT 1
- Bug play a ogg-sound with AudioDeviceDS in a debug mode.
- WASAPI Audio backend HOT 2
- Ouzel samples don't run (Ubuntu 17.10, i3)
- syntax error : "constant" HOT 3
- [Question] Scene events HOT 4
- [Engine init] Exclusive full screen exception HOT 1
- SetCursorPosition not working properly (?) HOT 1
- Ouzel openGL mode can't draw any content until moved/resized on macOS 10.14 HOT 3
- Ouzel reset shader uniform buffer offset at wrong place. HOT 1
- Run Sample crash by Android HOT 1
- cling based C++ as scripting language / hot code reload
- Samples crash with exception HOT 3
- kda direct buffer support HOT 4
- Rasp pi 4 compilation error HOT 2
- macOS game controller problem HOT 1
- Add a buildsystem HOT 2
- How to communicate with ObjC and Java?
- How to build from source on MSYS2 MINGW64?
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 ouzel.