Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (474)
Games in Android Showcase (105)
games submitted by our members
Games in WIP (524)
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] 2 3 ... 58
1  Game Development / Shared Code / Re: Scene2D replacement for Window on: 2014-06-11 00:49:34
Window was one of the first widgets in scene2d.ui and was built in a simple way. scene2d.ui has evolved a lot since then and Window is probably overdue for a rewrite. It shouldn't be too hard to write your own, as you found. When building an app with scene2d.ui, don't hesitate to build widgets specifically for your application.
2  Discussions / Miscellaneous Topics / Re: Infatuated on: 2014-06-02 23:30:08
She has another crush and i told her all my feelings. She said i deserve someone better but that's just a way of saying " i don't like you like that"
This actually means you deserve someone better. Sometimes you need to listen instead of hearing what you want to hear.
3  Discussions / Miscellaneous Topics / Re: Random syntax tweaks! on: 2014-05-31 22:32:43
"if(!(somevar > 0))" works just fine in Java.
4  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-29 17:45:01
Agreed, CSS is possibly the worst way to do layout.
5  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-24 09:46:29
I must learn JavaFX.... making GUIs in OpenGL and strangely designed XML is getting less and less appealing...

Sigh...  Lips Sealed
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Libgdx GL20 methods on: 2014-05-24 09:43:08
It isn't documented because it is OpenGL.
https://www.google.com/search?q=glVertexAttribPointer
7  Game Development / Newbie & Debugging Questions / Re: Libgdx Texture Array because of bleeding on: 2014-05-24 01:07:30
You can still have a standard tile size for placement and the collision layer. The way it works is the image for a tile can simply be any size. Makes it much easier to build maps. FWIW, Super Spineboy does this (using Tiled but the idea is the same).
8  Game Development / Newbie & Debugging Questions / Re: Libgdx Texture Array because of bleeding on: 2014-05-23 17:26:27
separate images for tiles... thats a nightmare for the artists. Every time there is something bigger than the tilesize they would have to cut it up, and then you would have to somehow pack it perfectly onto the tileset which happens automatically.
Tiles in libgdx are not limited to a specific size. You don't need to break a large image up into many small images, you can just use the large image.
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [libgdx] Drag and drop with scene2d tree on: 2014-05-23 17:22:35
1  
2  
3  
4  
// Select node under mouse if not over the selection.
Node overNode = tree.getNodeAt(y);
if (overNode == null && tree.getSelection().isEmpty()) return null;
if (overNode != null && !tree.getSelection().contains(overNode)) tree.getSelection().set(overNode);
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [libgdx] Drag and drop with scene2d tree on: 2014-05-23 09:31:42
Use DragAndDrop, add the tree as both a source and target. In the source, use the selected nodes for what to drag (can select the node under the mouse if nothing is selected). In the target, use Tree#getNodeAt(float y) to determine where the drop would happen. If getNodeAt is null and the mouse is over the tree, you know you are after the last visible node. Position an actor that is a sibling to the tree if you want to show where the drop will insert.
11  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-23 09:22:19
Where do you think I got the information I used? I didn't pull it out of my ass. I figured it out anyway.
You asked for help before making reasonable effort yourself.

Quote
I never instruct those who aren't full of passion, and I never enlighten those who aren't struggling to explain themselves. If I show you one corner and you can't show me the other three, I'll say nothing more. -Confucius
This forum has a nice ignore feature. Best of luck!
12  Game Development / Newbie & Debugging Questions / Re: Libgdx Texture Array because of bleeding on: 2014-05-23 09:09:54
I suggest using individual images in Tiled and then pack your images into an atlas for use at runtime (see AtlasTmxMapLoader). This allows you to change how the images are packed (padding, which images are on what atlas page, etc) without breaking your Tiled map.

Otherwise you could maybe fork libgdx, see the Mesh constructor which takes a VertexDataType. You'd need to add a new VertexData implementation.

trollwarrior1's approach is even simpler, just move UVs one texel toward the region center. This will stretch your images but filtering won't pick up neighboring regions (it will pick the texel you excluded).
13  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-22 11:18:55
RTFM
14  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 15:53:08
Haha Cheesy Nah, everyone knows scene2d is hard to use. And table? WTH is a table?!
15  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 15:07:52
Classic! Going overboard to help somebody, getting a 'nah' as response Smiley
When will I learn?  Huh
16  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 11:32:57
You didn't specify you wanted the UI created with Java2D. If you are making a game, using Java2D is not the way to do it.
17  Discussions / Business and Project Management Discussions / Re: Searching for a UI Developer (Mobile) [[Simple]] on: 2014-05-21 10:46:30
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  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.badlogic.gdx.utils.viewport.Viewport;

public class Mockup extends ApplicationAdapter {
   static final boolean debug = true;

   Viewport viewport;
   Stage stage;
   Skin skin;

   Actor currentScreen;

   public void create () {
      viewport = new ScreenViewport();
      stage = new Stage(viewport);
      Gdx.input.setInputProcessor(stage);
      createSkin();
      setScreen(new MainMenu());
   }

   void createSkin () {
      skin = new Skin();

      // Generate a 1x1 white texture and store it in the skin named "white".
     Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
      pixmap.setColor(Color.WHITE);
      pixmap.fill();
      skin.add("white", new Texture(pixmap));

      // Store the default libgdx font under the name "default".
     skin.add("default", new BitmapFont());

      // Configure a TextButtonStyle and name it "default".
     TextButtonStyle textButtonStyle = new TextButtonStyle();
      textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
      textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
      textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
      textButtonStyle.font = skin.getFont("default");
      skin.add("default", textButtonStyle);

      // Configure a LabelStyle and name it "default".
     LabelStyle labelStyle = new LabelStyle();
      labelStyle.font = skin.getFont("default");
      skin.add("default", labelStyle);
   }

   public void render () {
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
      stage.act();
      stage.draw();
      Table.drawDebug(stage);
   }

   public void resize (int width, int height) {
      viewport.update(width, height, true);
   }

   void setScreen (Actor newScreen) {
      int screenWidth = Gdx.graphics.getWidth();
      if (currentScreen != null)
         currentScreen.addAction(sequence(parallel(moveBy(-screenWidth, 0, 0.750f), fadeOut(0.750f)), removeActor()));
      currentScreen = newScreen;
      stage.addActor(newScreen);
      newScreen.setX(screenWidth);
      newScreen.getColor().a = 0;
      newScreen.addAction(parallel(moveBy(-screenWidth, 0, 0.750f), fadeIn(0.750f)));
   }

   class MainMenu extends Table {
      TextButton challenge30sButton, challenge1mButton, challenge5mButton, achievementsButton, highScoresButton;

      public MainMenu () {
         super(skin);
         if (debug) debug();
         createWidgets();
         createLayout();
         createEvents();
      }

      void createWidgets () {
         challenge30sButton = new TextButton("30 Second Challenge", skin);
         challenge1mButton = new TextButton("1 Minute Challenge", skin);
         challenge5mButton = new TextButton("5 Minute Challenge", skin);
         achievementsButton = new TextButton("Achievements", skin);
         highScoresButton = new TextButton("High Scores", skin);
      }

      void createLayout () {
         setFillParent(true);
         add("Game Name").row();
         pad(10).defaults().space(10).fillX();
         add(challenge30sButton).row();
         add(challenge1mButton).row();
         add(challenge5mButton).row();
         add(achievementsButton).row();
         add(highScoresButton).row();
      }

      void createEvents () {
         ClickListener gameOverListener = new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new GameOver());
            }
         };
         challenge30sButton.addListener(gameOverListener);
         challenge1mButton.addListener(gameOverListener);
         challenge5mButton.addListener(gameOverListener);
         highScoresButton.addListener(gameOverListener);

         achievementsButton.addListener(new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new Achievements());
            }
         });
      }
   }

   class Achievements extends Table {
      ScrollPane scroll;
      Table itemsTable;

      public Achievements () {
         super(skin);
         if (debug) debug();
         createWidgets();
         createLayout();
         populate();
      }

      void createWidgets () {
         itemsTable = new Table();
         scroll = new ScrollPane(itemsTable);
      }

      void createLayout () {
         setFillParent(true);
         add(scroll).expand().fill();

         itemsTable.pad(10).defaults().fillX().space(10);
      }

      public void populate () {
         ClickListener mainMenuListener = new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new MainMenu());
            }
         };
         for (int i = 0; i < 50; i++) {
            TextButton button = new TextButton("Achievement " + (i + 1), skin);
            itemsTable.add(button).row();
            button.addListener(mainMenuListener);
         }
      }
   }

   class GameOver extends Table {
      TextButton submitButton, shareButton, againButton;

      public GameOver () {
         super(skin);
         createWidgets();
         createLayout();
         createEvents();
      }

      void createWidgets () {
         submitButton = new TextButton("Submit High Score", skin);
         shareButton = new TextButton("Share Score", skin);
         againButton = new TextButton("Play Again!", skin);
      }

      void createLayout () {
         setFillParent(true);
         add("Game Name").row();
         pad(10).defaults().space(10).fillX();
         add("Your score: " + MathUtils.random(10, 100)).row();
         add(submitButton).row();
         add(shareButton).row();
         add(againButton).row();
      }

      void createEvents () {
         ClickListener mainMenuListener = new ClickListener() {
            public void clicked (InputEvent event, float x, float y) {
               setScreen(new MainMenu());
            }
         };
         submitButton.addListener(mainMenuListener);
         shareButton.addListener(mainMenuListener);
         againButton.addListener(mainMenuListener);
      }
   }

   public static void main (String[] args) throws Exception {
      LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
      config.width = 320;
      config.height = 480;
      new LwjglApplication(new Mockup(), config);
   }
}

It is completely self contained, you just need to paste it into a libgdx project. Use it as a start to learn this stuff yourself!
18  Game Development / Performance Tuning / Re: Cache locality and LibStruct - fixing Java's horrible memory layout on: 2014-05-20 17:43:48
How about showing some code so I can see the difference with and without LibStruct without putting in much effort? Cheesy
19  Discussions / General Discussions / Re: Is it just me, or does everyone's GUI code look like spaghetti? on: 2014-05-16 16:40:03
Just add support for panels, in which components have an offset relative to their parent. Then pump events through the root, and let the panel deliver the events to the descendants, making the coordinates relative to each component you pass them through - just like AWT, Swing, HTML, etc.
Aka a scene graph! Cheesy I don't think they are listening though.
20  Games Center / Showcase / Re: Super Spineboy on: 2014-05-15 09:41:55
Thanks. Smiley Spineboy looks aliased in the screenshots and when the window is sized smaller because the source graphics are pretty high resolution. It should look nice maximized or full screen (alt+enter or use the menu):



You can see how the skeleton size is computed here:
https://github.com/EsotericSoftware/spine-superspineboy/blob/master/src/com/esotericsoftware/spine/superspineboy/Assets.java#L93
This sets the scale of the skeleton data loaded from JSON to "Player.height / Player.heightSource". Player.height is the height you want the player in game units. Player.heightSource is the height the player was in Spine in pixels. So if you want the player 10 game units tall and it was 200 pixels tall in Spine, you'd use a scale of 10/200=0.05.

That is how you would scale the skeleton data to whatever you use for units in your game. Eg, with Box2D you may be using meters instead of pixels. However, the same technique can be used to scale the skeleton data to match a texture atlas of a different size. When you pack your texture atlas, you might scale it up or down. Spine can pack an atlas using a scale, so can Texture Packer Pro, etc. You probably want to pack 2-3 atlases at different sizes to target a few resolutions. At runtime you choose the best atlas for the resolution and set the scale accordingly. Eg, if you pick an atlas that is 33% the size of the art used in Spine, you would use "json.setScale(0.33f)". Of course you can combine this with a scale for your game units, "json.setScale(Player.height / Player.heightSource * 0.33f);".
21  Discussions / General Discussions / Re: New Personal Virtual Reality Headset System – ANTVR KIT on: 2014-05-14 22:31:48
It looks neat. The gun is cool, especially as standard equipment. Converting to a joystick is neat, but the controller looks like it would be flimsy. The English in the video was a bit painful, but I understand you guys wanted the actual team to be in the video. I would have liked to see more about what sets it apart from the Occulus, which is the elephant in the room. Also, I tried an Occulus and instantly wanted to take it off. I couldn't stand a screen so close to my eyes. I don't know if this would happen to me on yours, so I have a hard time backing.
22  Java Game APIs & Engines / OpenGL Development / Re: Design or pattern for handling background consumer/producer tasks on: 2014-05-14 22:19:49
libgdx's AssetManager is a system for running tasks that can have a part on the GL thread and a part on a separate thread. It was quite tricky to get right. This enables rendering a progress bar (or other anything else) while things are loading. It also has ref counting, so assets can auto unload when no longer needed.

Another experience I have similar to what you are asking about I solved with Riven and MatthiasM's green thread library:
https://github.com/riven8192/LibContinuations
This allowed me to run code on the render thread, but yield so I can still render things. Without being able to yield in my tasks, I would have had to store an enormous amount of state so I could resume the work later.
23  Discussions / General Discussions / Re: Is it just me, or does everyone's GUI code look like spaghetti? on: 2014-05-14 09:52:21
Look at how a 2D scene graph works.
24  Discussions / General Discussions / Re: Is it just me, or does everyone's GUI code look like spaghetti? on: 2014-05-14 09:38:45
I've put a lot of effort into making UI code nice: DSL, visual editor, etc. The best thing I've come up with is: use a sane 2D scene graph that has the features needed for UIs (drawing, layout, events), use a flexible layout manager with a builder style API, and organize your code by separating it into 3 parts: creation, layout, and events. I can suggest scene2d.ui and TableLayout for the first two. You can see this example UI code for how it looks in practice. This code isn't too bad, but could be organized slightly better. For complex UI code I usually have 3 separate methods for creation, layout, and events. It really makes a difference, as it is hard to make any sense of layout code when it is mixed with other things.
25  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Nested Tables Rendering incorrectly on: 2014-05-12 21:45:00
https://github.com/libgdx/libgdx/wiki/Scene2d.ui#stage-setup
Quote
Normally a widget's size is set by its parent and setFillParent must not be used. setFillParent is for convenience only when the widget's parent does not set the size of its children (such as the stage).
26  Game Development / Newbie & Debugging Questions / Re: libgdx decals on: 2014-05-12 19:10:17
Lots of bickering in here. Do I have to send you kids to your rooms?
27  Games Center / Showcase / Re: Super Spineboy on: 2014-05-12 19:08:11
Mr.CodeIt, yeah I haven't bothered to fix that bug. Smiley

atombrot, strange, it works for me no matter what the window size is. Maybe you are just seeing the recoil? There is quite a lot of recoil, to give you a reason not to shoot (otherwise why even have a shoot button and shoot all the time? Smiley).
28  Game Development / Newbie & Debugging Questions / Re: Scaling a display with libGDX on: 2014-05-12 18:39:04
The camera has 0,0 at the center of the screen by default. You can adjust it so 0,0 is the bottom left corner.

1  
camera.position.set(worldWidth / 2, worldHeight / 2, 0);


Viewport#update(int, int, boolean) can do this for you if you pass true.
29  Game Development / Game Mechanics / Re: LWJGL Best way to handle 2D Sprite Animations? on: 2014-05-12 12:17:57
Spine would reduce your need to have so many images, as well as allow you to have many more animations, including procedural animation (eg looking at the mouse).
30  Games Center / Showcase / Re: Super Spineboy on: 2014-05-09 20:53:01
Thanks kappa! Smiley When the alien head explodes obviously the head and splatter changes images a few times, but notice Spine is used to scale, fade and translate the images.

I change the alien head to the first frame of the exploding head when they have one hit point left, and they behavior changes to be more aggressive. It wasn't planned to use the first frame like that, but it looked cool.  Cool
Pages: [1] 2 3 ... 58
 

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

The first screenshot will be displayed as a thumbnail.

Riven (26 views)
2014-07-10 20:20:18

CopyableCougar4 (25 views)
2014-07-10 02:26:14

CopyableCougar4 (31 views)
2014-07-09 02:55:38

Code Mage (31 views)
2014-07-08 23:57:00

Code Mage (19 views)
2014-07-08 23:49:08

AppleSauce (27 views)
2014-07-08 19:25:32

CopyableCougar4 (27 views)
2014-07-06 01:51:26

ipe369 (33 views)
2014-07-05 14:18:25

vastrolorde (43 views)
2014-07-04 18:45:44

theagentd (60 views)
2014-07-02 22:19:37
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!