Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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  Java Game APIs & Engines / Android / Re: Making an desktop+handheld game considerations on: 2010-07-12 17:48:38
Thanks for the plug tris2k. Smiley I wish I had more time to spend on Skorpios. I just got a puppy and it is a huge time sink! Cutest thing in the world tho. She's sleeping on my lap right now. Cheesy

Baby is a full time responsibility  Grin

Why just support Android and J2SE when you can get J2ME as well.

Is JME worth the effort?  Undecided
2  Java Game APIs & Engines / Android / Re: Making an desktop+handheld game considerations on: 2010-07-07 13:59:06
There currently are two projects that I'm aware of that try to facilitate desktop/android development with one game codebase for both platforms. Others android specific, but alot of droid 2d/3d/modelloader etc projects on google code:
1. LibGDX: http://code.google.com/p/libgdx/ (2D w/ GL context)
Uses jogl for the desktop impl.
blog: http://apistudios.com/hosted/marzec/badlogic/wordpress/

2. Scorpios: one of Nate's projects http://code.google.com/p/skorpios/ (2D w/ GL context)
Uses lwjgl for the desktop impl.

3. jPCT-AE - an Android port of jPCT (3D)
http://www.jpct.net/jpct-ae/

4. Ardor3D on Android (3D)
http://www.ardor3d.com/wiki/android_dev

A Couple Android Specific:
Rokon: http://code.google.com/p/rokon/ (2D)
http://rokonandroid.com/

AndEngine http://code.google.com/p/andengine/ (2D)
blog: http://www.andengine.org/blog/

Would be cool if the wonderful slick2d would be ported to android. Kev was first discouraged by floating point performance of android, but as he said targeting 2.0+ should be ok. Really seems so considering the capabilities of these new droid devices.

So let's make something. No reason why slick shouldn't be running on android.

I started a little android/desktop  project. It borrows the GL abstraction layer from libgdx (i removed most of the ES specific methods)
It uses lwjgl for the desktop impl. Api similar to slick2d w/ xna stuff.
 
Troid:  http://code.google.com/p/troid/
My Tube  Grin  http://www.youtube.com/user/droidgamers
Typical game looks something like:

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  
public class Game1 extends Game {
        .....
   public Game1 (String title){
      super(title);
   }

   public void init(GameContainer c) {
      // Texture2D
     tex = Content.getTexture("res/example.png");  
      flip = tex.flippedCopy(true, true);      
      scaled = tex.scaledCopy(0.5f);      
      sub = tex.getSubTexture(0, 0, tex.width/2, tex.height/2);
     
      // Animation
     anim = Content.getAnimation("res/homingmissile.png",64,64);  
      anim.setPingPong(true);
     
      // XML SpriteSheet
     sheet = Content.getXMLSpriteSheet("game1/game1_pack.png", "game1/game1_pack.png.xml");
      cannon = sheet.getSprite("cannon.png");
      c.showDebug(true);
   }  

   public void update(GameContainer c, float delta) {
                ....
   }

   public void draw(GameContainer c, Graphics g) {  
      g.drawTexture(tex, 0,0);
      g.drawTexture(flip, 0,0);
      g.drawTexture(sub, 0,0);
      g.drawAnimation(anim, 100,100);
      g.drawString("Line 2\tLine 2\tLine 2\tLine 2", 100,500);      
   }  

   public static void main(String[] args) {  
      DesktopGameContainer gc = new DesktopGameContainer();
      gc.setGame(new Game1("Game1 Test - Desktop"));
      gc.start();
   }
}


The same code runs on both android and the desktop. Only difference being the 6 line launcer for android:
1  
2  
3  
4  
5  
6  
public class TestsLauncher extends GameActivity {
   public void onCreate(AndroidGameContainer gc) {        
                gc.setGame(new Game1("Game1 Test - Android"));
      gc.start();
   }
}


As for screen size considerations, scaling the gl context should do the trick. Think that's how iphone games work on the ipad


Those other projects are alot more advanced than mine , but im trying to incorporate as much of slick's functionality as I can manage. If anyone with a phone can test out the demos that would be great. i don't have one.
Checkout the code. let me know how much it sucks. Did i mention i'm a gl n00b?  Grin

3  Game Development / Shared Code / Re: Utils essentials on: 2010-06-24 18:07:52
Use Non-Power Of 2 Textures.
On Android, this converts a Non Pow of 2 texture to and OpenGL(ES) ready Bitmap.
No more batch image resizing Smiley

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
   private Bitmap glBitmap(Bitmap bitmap) {
      Bitmap pbmp;
      int texWidth = get2Fold(bitmap.getWidth());
      int texHeight = get2Fold(bitmap.getHeight());
      pbmp = Bitmap.createBitmap(texWidth, texHeight, bitmap.getConfig());
      for (int y = 0; y < bitmap.getHeight(); y++) {
         for (int x = 0; x < bitmap.getWidth(); x++) {
            pbmp.setPixel(x, y, bitmap.getPixel(x, y));
         }
      }
      return pbmp;
   }

1  
2  
3  
4  
5  
6  
7  
   public static int get2Fold(int fold) {
       int ret = 2;
       while (ret < fold) {
           ret *= 2;
       }
       return ret;
   }


Your texture will then use the texture coordinates:

1  
2  
widthRatio = (float) width / (texWidth < 1 ? width : texWidth);   
heightRatio = (float) height / (texHeight < 1 ? height : texHeight);


Where width is the original image with and texWidth is the with of the new Pow Of 2 texture Bitmap return by glBitmap()...
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.

Nickropheliac (16 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (42 views)
2014-08-19 09:29:53

Tekkerue (41 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (26 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (73 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

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

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

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!