Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
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  
  How to identify device in Java code  (Read 1859 times)
0 Members and 1 Guest are viewing this topic.
Offline rockhard

Junior Newbie




Java games rock!


« Posted 2004-05-06 19:53:00 »

Hi, I am novice here as well as J2ME.

My question is how can I use a pice of code to identify phone type? For instance, Nokia, Motorola, Sony, & etc. If I want to apply FullCanvas in different phone, I think may be I should know device type before I can do anything else.

Thanks,
Offline davidaprice

Junior Member





« Reply #1 - Posted 2004-05-07 07:18:27 »

In principle, you should be able to call:
1  
System.getProperty("microedition.platform")

- each different phone model should return a different String value. For instance, my Nokia 6600 returns "Nokia 6600/4.09.1" - the phone model and its software version number.
Offline Abuse

JGO Coder


Medals: 2


falling into the abyss of reality


« Reply #2 - Posted 2004-05-07 08:51:28 »

Due to size constraints, it is nearly always preferable to have different build versions of your app. for the various phones, rather than runtime detection of the phone.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline rockhard

Junior Newbie




Java games rock!


« Reply #3 - Posted 2004-05-12 21:23:57 »

thx folks

I am moving on sprite creation issue. I'd like to have MIDP 2.0 Sprite class feature or similar behavior in MIDP 1.0. Any resource or example to build Sprite class?

MIDP 2.0 Sprite class involves 2 much native call that cannot be used in MIDP 1.0. Sick.
Offline darcone

Junior Member




Size matters


« Reply #4 - Posted 2004-05-12 23:09:58 »

What is a sprite class?  Huh
Offline rockhard

Junior Newbie




Java games rock!


« Reply #5 - Posted 2004-05-13 03:39:08 »

for a game developing, in MIDP 2.0 a Sprite class is very easy to handle img movement. Without that, it is very handy to repaint a game screen.

any idea for MIDP 1.0?
Offline mrmx

Senior Newbie




Java may rule world of bits...


« Reply #6 - Posted 2004-05-13 06:55:18 »

Hi!

You can check JTGL library (http://www.jtgl.org) that contains a gaming package nearly compatible with midp2 one.
So you have Surfaces (Layers in Midp2), TiledSurfaces (TiledLayer in Midp2),Sprites and SurfaceManagers (LayerManagers in Midp2) Wink

Cheers!

Greetings

Manuel Polo.
Offline davidaprice

Junior Member





« Reply #7 - Posted 2004-05-13 07:10:01 »

It's pretty easy to make your own Sprite class in MIDP 1.0. All you need is an image with all the animation frames in a row, and then a paint method something like this:
1  
2  
3  
4  
5  
6  
7  
    void paint(Graphics g)
    {
        g.setClip(x, y, width, height);
        g.drawImage(animationFramesImg,
                    x - width * frameIndex[state][frame], y,
                    Graphics.TOP | Graphics.LEFT);
    }

Where state tells whether you're walking left, walking right, jumping, etc., and frame is just the current index into the animation frame sequence for that state.

For a full example, see Game Animation with Java MIDP at Forum Nokia.
Offline darcone

Junior Member




Size matters


« Reply #8 - Posted 2004-05-13 09:46:30 »

Hmm sounds like something you can do with a array and some magic Smiley
*wishes for structs in java*
Offline Abuse

JGO Coder


Medals: 2


falling into the abyss of reality


« Reply #9 - Posted 2004-05-13 11:19:10 »

indeed,
in midp :-

less > more

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here!
Games published by our own members! Check 'em out!
Try the Free Demo of Droid Assault
Offline rockhard

Junior Newbie




Java games rock!


« Reply #10 - Posted 2004-05-17 21:21:24 »

mumm, sounds lot of things to test it out.

Thx folks

Where did you get that icon darcone, maybe useful in a game sprite. :-D Just a thought.

Offline darcone

Junior Member




Size matters


« Reply #11 - Posted 2004-06-07 12:52:43 »

The bigass robot? It is part of the images you can choose from here on JGO.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (71 views)
2013-05-17 21:29:12

alaslipknot (82 views)
2013-05-16 21:24:48

gouessej (112 views)
2013-05-16 00:53:38

gouessej (107 views)
2013-05-16 00:17:58

theagentd (118 views)
2013-05-15 15:01:13

theagentd (107 views)
2013-05-15 15:00:54

StreetDoggy (151 views)
2013-05-14 15:56:26

kutucuk (175 views)
2013-05-12 17:10:36

kutucuk (172 views)
2013-05-12 15:36:09

UnluckyDevil (181 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.099 seconds with 21 queries.