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;








0















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!










share|improve this question

















  • 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

















0















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!










share|improve this question

















  • 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













0












0








0








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!










share|improve this question














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!







android libgdx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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












  • 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












1 Answer
1






active

oldest

votes


















0














You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.






    share|improve this answer



























      0














      You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.






      share|improve this answer

























        0












        0








        0







        You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.






        share|improve this answer













        You aren't using the camera until you call batch.setProjectionMatrix(camera.combined);.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 22 at 23:39









        Tenfour04Tenfour04

        16.1k53681




        16.1k53681





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해