Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: LibGDX - Window contents overstrech upon resizing on: 2013-09-16 16:32:45
Try making an orthographic camera. There is a wiki page here. https://code.google.com/p/libgdx/wiki/OrthographicCamera

Ok, i'll give that a try. Thanks for the link!

EDIT:
1  
cam.setToOrtho(false, width, height);

WORKED LIKE A CHARM!! THANK YOU EVERYBODY!!  Grin
2  Game Development / Newbie & Debugging Questions / Re: LibGDX - Window contents overstrech upon resizing on: 2013-09-16 06:56:13
Yes sir. May we see some of the init code ?
Im no opengl expert, but its clearly a viewport issue.

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  
   public void init() {
      font = new BitmapFont(Gdx.files.internal("gfx/font.fnt"), false);
      font.setColor(0.9254902F, 0.9254902F, 0.9254902F, 1);
     
      inactive = new Texture(Gdx.files.internal("gfx/CABLE-OFF.png"));
      scrollUp = new Texture(Gdx.files.internal("gfx/UP.png"));
      scrollDown = new Texture(Gdx.files.internal("gfx/DOWN.png"));

      bgtex = new Texture(Gdx.files.internal("gfx/UIBG.png"));
      bgsel = new Texture(Gdx.files.internal("gfx/UISEL.png"));
     
      left[0] = new Texture(Gdx.files.internal("gfx/NOT.png"));
      left[1] = new Texture(Gdx.files.internal("gfx/AND.png"));
      left[2] = new Texture(Gdx.files.internal("gfx/OR.png"));
      left[3] = new Texture(Gdx.files.internal("gfx/XOR.png"));
      left[4] = new Texture(Gdx.files.internal("gfx/SWITCH-OFF.png"));
      left[5] = new Texture(Gdx.files.internal("gfx/LIGHT-OFF.png"));
     
      right[0] = new Texture(Gdx.files.internal("gfx/UIOPT.png"));
      right[1] = new Texture(Gdx.files.internal("gfx/SWITCH-ON.png"));
     
      options[0] = new Texture(Gdx.files.internal("gfx/UNDO.png"));
      options[1] = new Texture(Gdx.files.internal("gfx/SAVE.png"));
      options[2] = new Texture(Gdx.files.internal("gfx/LOAD.png"));

      sb = new SpriteBatch();
   }


I don't know about libGdx but here's how to change the viewport in LWJGL. You can find a similar mechanism in libGdx.

1  
2  
3  
4  
public void resized()
{
    glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
}


I found
1  
 Gdx.gl20.glViewport(0, 0, width, height); 
, but it didn't do a thing.
Thanks anyways!

If you can click in black space to have the button respond, it probably has more to do with how you're rendering the diagram...post a snippet maybe?

1  
2  
3  
4  
5  
6  
public void render() {
   sb.begin();
   sb.draw(bgtex, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   //Draw rest of the UI
  sb.end();
}
3  Game Development / Newbie & Debugging Questions / Re: LibGDX - Window contents overstrech upon resizing on: 2013-09-15 22:20:02
Wow, that was quick!

My resize method is currently empty, and there are no cameras to readjust(or is there a default camera?). The sprites' positions are defined using getWidth() and getHeight().
4  Game Development / Newbie & Debugging Questions / [SOLVED] LibGDX - Window contents overstrech upon resizing on: 2013-09-15 21:54:24
Hi everybody!
I'm new to libgdx and to this great forum so please don't hurt me if I do something stupid..

Anyway, I'm making a logic circuit simulator for desktop and mostly Android, and I ran into a problem which didn't see anywhere on the Internet:

Here's the program with it's default size:

This is how it should look at all times.

And this is how it looks if I make the window smaller:


The UI should adjust to the new size, but it shrinks too much. The controls work OK (a click in the blackness in the bottom right corner toggles the options panel).

If the program starts with a different default value, it looks well only on that size.

I searched the Internet about this, but nothing came up ( or I'm just too blind  Tongue ).

I know it's a stupid problem that I should be able to solve, but as I stated, I'm new to libGDX.

Oh, and the problem probably has to do something with the fact that I don't use cameras.

Any help would be awesome and thanks in advance!
Btw: This forum ROCKS!!
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (34 views)
2014-07-18 06:55:21

Zero Volt (30 views)
2014-07-17 23:47:54

danieldean (25 views)
2014-07-17 23:41:23

MustardPeter (27 views)
2014-07-16 23:30:00

Cero (42 views)
2014-07-16 00:42:17

Riven (44 views)
2014-07-14 18:02:53

OpenGLShaders (32 views)
2014-07-14 16:23:47

Riven (33 views)
2014-07-14 11:51:35

quew8 (30 views)
2014-07-13 13:57:52

SHC (66 views)
2014-07-12 17:50:04
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

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!