Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Screen gets messed up on some android devices! :(  (Read 336 times)
0 Members and 1 Guest are viewing this topic.
Offline Delta517

Senior Member


Medals: 2
Projects: 1



« Posted 2013-06-10 19:05:58 »

So when I'm trying my game (I only got a splashscreen, mainmenu and some How to Play screens at the time) on my PC, everything works fine, but when I try on my android devices (Xperia PLAY and S3) it places the splashscreen and mainmenu screen where I want (although it scales it down on S3, guessing its the resolution), but with the how to play screens it places it at the bottom right :O

Help? Sad
Offline dermetfan

Senior Member


Medals: 11



« Reply #1 - Posted 2013-06-10 19:48:40 »

No need to show us your code or anything because the problem can't possibly be there. Unfortunately, no I haven't the faintest glimpse of a shadow of what might eventually become a hint of an idea on why your getting this error. Good luck debugging though!
Sorry, but I just found that too hilarious Grin
Anyway, we probably really need to see some code because we don't know
  • what framework you're using if any
  • what the screen class even is in there
  • ...anything

Offline Delta517

Senior Member


Medals: 2
Projects: 1



« Reply #2 - Posted 2013-06-10 20:06:33 »

Oh lol, srry xD Was to busy watching the M$ E3 conference Tongue Im using Libgdx

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
package com.mayogames.zombiecubes.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.mayogames.zombiecubes.ZombieCubes;

public class HelpScreen1 implements Screen {
   
   ZombieCubes zombieCubes;
   
   Stage stage;
   TextureAtlas atlas;
   Skin skin;
   SpriteBatch batch;
   Texture helpScreen1Texture;
   
   OrthographicCamera camera;
   Rectangle glViewport;
   
   Button arrowLeftButton;
   Button arrowRightButton;
   
   public HelpScreen1(ZombieCubes zombieCubes){
      this.zombieCubes = zombieCubes;
   }

   @Override
   public void render(float delta) {
      GL10 gl = Gdx.graphics.getGL10();
     
      Gdx.gl.glClearColor(0, 0, 0, 1);
      Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
     
      gl.glViewport((int) glViewport.x, (int) glViewport.y,
                (int) glViewport.width, (int) glViewport.height);
     
      camera.update();
        camera.apply(gl);
     
      stage.act(delta);
     
      batch.begin();
      stage.draw();
      batch.end();
     
   }

   @Override
   public void resize(int width, int height) {
      if(stage == null){
         stage = new Stage(width, height, true);
         stage.clear();
         
         Gdx.input.setInputProcessor(stage);
         
         helpScreen1Texture = new Texture(Gdx.files.internal("data/HelpScreens/HelpScreen1.png"));
         helpScreen1Texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
         
         TextureRegion helpScreen1Region = new TextureRegion(helpScreen1Texture, 0, 0, 800, 480);
         Image helpScreen1Image = new Image(helpScreen1Region);
         helpScreen1Image.setX(0);
         helpScreen1Image.setY(0);
         
         ButtonStyle arrowLeftStyle = new ButtonStyle();
         arrowLeftStyle.up = skin.getDrawable("arrowLeft");
         arrowLeftStyle.down = skin.getDrawable("arrowLeftPressed");
         
         ButtonStyle arrowRightStyle = new ButtonStyle();
         arrowRightStyle.up = skin.getDrawable("arrowRight");
         arrowRightStyle.down = skin.getDrawable("arrowRightPressed");
         
         arrowRightButton = new Button(arrowRightStyle);
         arrowRightButton.setWidth(64);
         arrowRightButton.setHeight(64);
         arrowRightButton.setX(735);
         arrowRightButton.setY(0);
         arrowRightButton.addListener(new InputListener(){
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){
               return true;
            }
            public void touchUp(InputEvent event, float x, float y, int pointer, int button){
               zombieCubes.setScreen(new HelpScreen2(zombieCubes));
            }
            });
         
         stage.addActor(helpScreen1Image);
         stage.addActor(arrowRightButton);
      }
   }

   @Override
   public void show() {
      batch = new SpriteBatch();
      atlas = new TextureAtlas("data/Misc/buttons.atlas");
      skin = new Skin();
      skin.addRegions(atlas);
     
      camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);
     
        glViewport = new Rectangle(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   }

   @Override
   public void hide() {
      // TODO Auto-generated method stub
     
   }

   @Override
   public void pause() {
      // TODO Auto-generated method stub
     
   }

   @Override
   public void resume() {
      // TODO Auto-generated method stub
     
   }

   @Override
   public void dispose() {
      helpScreen1Texture.dispose();
      batch.dispose();
      stage.dispose();
      skin.dispose();
      atlas.dispose();
     
   }

}


This is just one example out of the three others helpscreens I have Smiley The other twos don't have the camera in it, but it didn't make a difference :/
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Delta517

Senior Member


Medals: 2
Projects: 1



« Reply #3 - Posted 2013-06-11 23:40:52 »

Anyone? Sad
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!