Android Studio libgdx setToOrtho(ydown = true) does not workChanging the Coordinate System in LibGDX (Java)Is there a way to run Python on Android?How do save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?“Debug certificate expired” error in Eclipse Android pluginsIs there a unique Android device ID?What is 'Context' on Android?libgdx: SpriteBatch not displayed with PerspectiveCameraProper use cases for Android UserManager.isUserAGoat()?Android Studio: Add jar as library?
Roll the carpet
Can a vampire attack twice with their claws using multiattack?
Get value of a counter
Linear Path Optimization with Two Dependent Variables
Question on branch cuts and branch points
Why is Minecraft giving an OpenGL error?
How old can references or sources in a thesis be?
Can I ask the recruiters in my resume to put the reason why I am rejected?
Can a Cauchy sequence converge for one metric while not converging for another?
High voltage LED indicator 40-1000 VDC without additional power supply
Do I have a twin with permutated remainders?
Can you really stack all of this on an Opportunity Attack?
Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?
DC-DC converter from low voltage at high current, to high voltage at low current
Operational amplifier as a comparator at high frequency
Are the number of citations and number of published articles the most important criteria for a tenure promotion?
How does one intimidate enemies without having the capacity for violence?
Replacing matching entries in one column of a file by another column from a different file
Two films in a tank, only one comes out with a development error – why?
Why are electrically insulating heatsinks so rare? Is it just cost?
Which country benefited the most from UN Security Council vetoes?
Why does Kotter return in Welcome Back Kotter?
Maximum likelihood parameters deviate from posterior distributions
how to check a propriety using r studio
Android Studio libgdx setToOrtho(ydown = true) does not work
Changing the Coordinate System in LibGDX (Java)Is there a way to run Python on Android?How do save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?“Debug certificate expired” error in Eclipse Android pluginsIs there a unique Android device ID?What is 'Context' on Android?libgdx: SpriteBatch not displayed with PerspectiveCameraProper use cases for Android UserManager.isUserAGoat()?Android Studio: Add jar as library?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
i´m currently working on a Android game with the library libgdx. Currently I m facing a problem, where the xy-coordinate system is flipt.
I did some research and found that if you use a OrthographicCamera you can change the y coordinate so its no longer flipt.
Code:
public class Game extends ApplicationAdapter
Miner miner;
SpriteBatch batch;
TouchManager touchManager;
OrthographicCamera camera;
public void create()
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
miner = new Miner(new Texture(Gdx.files.internal("miner_lv1.png")), 0, 0, 200, 200);
batch = new SpriteBatch();
touchManager = new TouchManager();
public void render()
//update
camera.update();
touchManager.update(camera);
miner.update();
//drawing
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(Gdx.gl20.GL_COLOR_BUFFER_BIT);
batch.begin();
miner.render(batch);
batch.end();
public void dispose()
batch.dispose();
miner.dispose();
Miner:
public class Miner extends Entity
public Miner(Texture texture, int x, int y, int width, int height)
super(texture, x, y, width, height);
@Override
public void update()
sprite.setX(x);
sprite.setY(y);
@Override
public void render(SpriteBatch batch)
sprite.draw(batch);
@Override
public void dispose()
texture.dispose();
The output is as following:
Ouptut of code
My question is how do i change the coordinate system that x = 0 and y = 0 is in the top left corner.
Thank you in advance!
add a comment |
i´m currently working on a Android game with the library libgdx. Currently I m facing a problem, where the xy-coordinate system is flipt.
I did some research and found that if you use a OrthographicCamera you can change the y coordinate so its no longer flipt.
Code:
public class Game extends ApplicationAdapter
Miner miner;
SpriteBatch batch;
TouchManager touchManager;
OrthographicCamera camera;
public void create()
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
miner = new Miner(new Texture(Gdx.files.internal("miner_lv1.png")), 0, 0, 200, 200);
batch = new SpriteBatch();
touchManager = new TouchManager();
public void render()
//update
camera.update();
touchManager.update(camera);
miner.update();
//drawing
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(Gdx.gl20.GL_COLOR_BUFFER_BIT);
batch.begin();
miner.render(batch);
batch.end();
public void dispose()
batch.dispose();
miner.dispose();
Miner:
public class Miner extends Entity
public Miner(Texture texture, int x, int y, int width, int height)
super(texture, x, y, width, height);
@Override
public void update()
sprite.setX(x);
sprite.setY(y);
@Override
public void render(SpriteBatch batch)
sprite.draw(batch);
@Override
public void dispose()
texture.dispose();
The output is as following:
Ouptut of code
My question is how do i change the coordinate system that x = 0 and y = 0 is in the top left corner.
Thank you in advance!
1
Possible duplicate of Changing the Coordinate System in LibGDX (Java)
– Luis Fernando Frontanilla
Mar 22 at 2:23
No, i got the information about the ydown from there, but it doesnt work as you can see.
– DavidDev
Mar 22 at 7:34
it if is in the top left corner by default.
– icarumbas
Mar 22 at 22:03
add a comment |
i´m currently working on a Android game with the library libgdx. Currently I m facing a problem, where the xy-coordinate system is flipt.
I did some research and found that if you use a OrthographicCamera you can change the y coordinate so its no longer flipt.
Code:
public class Game extends ApplicationAdapter
Miner miner;
SpriteBatch batch;
TouchManager touchManager;
OrthographicCamera camera;
public void create()
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
miner = new Miner(new Texture(Gdx.files.internal("miner_lv1.png")), 0, 0, 200, 200);
batch = new SpriteBatch();
touchManager = new TouchManager();
public void render()
//update
camera.update();
touchManager.update(camera);
miner.update();
//drawing
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(Gdx.gl20.GL_COLOR_BUFFER_BIT);
batch.begin();
miner.render(batch);
batch.end();
public void dispose()
batch.dispose();
miner.dispose();
Miner:
public class Miner extends Entity
public Miner(Texture texture, int x, int y, int width, int height)
super(texture, x, y, width, height);
@Override
public void update()
sprite.setX(x);
sprite.setY(y);
@Override
public void render(SpriteBatch batch)
sprite.draw(batch);
@Override
public void dispose()
texture.dispose();
The output is as following:
Ouptut of code
My question is how do i change the coordinate system that x = 0 and y = 0 is in the top left corner.
Thank you in advance!
i´m currently working on a Android game with the library libgdx. Currently I m facing a problem, where the xy-coordinate system is flipt.
I did some research and found that if you use a OrthographicCamera you can change the y coordinate so its no longer flipt.
Code:
public class Game extends ApplicationAdapter
Miner miner;
SpriteBatch batch;
TouchManager touchManager;
OrthographicCamera camera;
public void create()
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
miner = new Miner(new Texture(Gdx.files.internal("miner_lv1.png")), 0, 0, 200, 200);
batch = new SpriteBatch();
touchManager = new TouchManager();
public void render()
//update
camera.update();
touchManager.update(camera);
miner.update();
//drawing
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(Gdx.gl20.GL_COLOR_BUFFER_BIT);
batch.begin();
miner.render(batch);
batch.end();
public void dispose()
batch.dispose();
miner.dispose();
Miner:
public class Miner extends Entity
public Miner(Texture texture, int x, int y, int width, int height)
super(texture, x, y, width, height);
@Override
public void update()
sprite.setX(x);
sprite.setY(y);
@Override
public void render(SpriteBatch batch)
sprite.draw(batch);
@Override
public void dispose()
texture.dispose();
The output is as following:
Ouptut of code
My question is how do i change the coordinate system that x = 0 and y = 0 is in the top left corner.
Thank you in advance!
asked Mar 21 at 22:12
DavidDevDavidDev
11
11
1
Possible duplicate of Changing the Coordinate System in LibGDX (Java)
– Luis Fernando Frontanilla
Mar 22 at 2:23
No, i got the information about the ydown from there, but it doesnt work as you can see.
– DavidDev
Mar 22 at 7:34
it if is in the top left corner by default.
– icarumbas
Mar 22 at 22:03
add a comment |
1
Possible duplicate of Changing the Coordinate System in LibGDX (Java)
– Luis Fernando Frontanilla
Mar 22 at 2:23
No, i got the information about the ydown from there, but it doesnt work as you can see.
– DavidDev
Mar 22 at 7:34
it if is in the top left corner by default.
– icarumbas
Mar 22 at 22:03
1
1
Possible duplicate of Changing the Coordinate System in LibGDX (Java)
– Luis Fernando Frontanilla
Mar 22 at 2:23
Possible duplicate of Changing the Coordinate System in LibGDX (Java)
– Luis Fernando Frontanilla
Mar 22 at 2:23
No, i got the information about the ydown from there, but it doesnt work as you can see.
– DavidDev
Mar 22 at 7:34
No, i got the information about the ydown from there, but it doesnt work as you can see.
– DavidDev
Mar 22 at 7:34
it if is in the top left corner by default.
– icarumbas
Mar 22 at 22:03
it if is in the top left corner by default.
– icarumbas
Mar 22 at 22:03
add a comment |
1 Answer
1
active
oldest
votes
You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290037%2fandroid-studio-libgdx-settoorthoydown-true-does-not-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.
add a comment |
You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.
add a comment |
You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.
You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.
answered Mar 22 at 23:39
Tenfour04Tenfour04
16.1k53681
16.1k53681
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290037%2fandroid-studio-libgdx-settoorthoydown-true-does-not-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Possible duplicate of Changing the Coordinate System in LibGDX (Java)
– Luis Fernando Frontanilla
Mar 22 at 2:23
No, i got the information about the ydown from there, but it doesnt work as you can see.
– DavidDev
Mar 22 at 7:34
it if is in the top left corner by default.
– icarumbas
Mar 22 at 22:03