Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
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 / J2ME / Re: 3D Modelage on: 2005-05-20 00:22:17
Iver heard that the latest version of 3d studio max, will output to the java format for 3d.
2  Java Game APIs & Engines / J2ME / Re: 3D shoot game feedback and ideas on: 2005-04-10 23:30:24
I cannot get the avi to play in windows media player or winamp video player.
3  Java Game APIs & Engines / J2ME / Re: .png image bug on: 2005-04-09 01:08:03
The solution I've finnally come up with is to not use getRgb and createRGBIMage at all.  Since I'm not worried about tranparent pixels in this game, I instead set a clip region in the image im resizing and paint the old image.  Its very slow is the only probelm.  I modified Yu You's code to use image painting instead of getRGB and now it works on my device and is midp 1.0 compatible.  Only problem is its slow and it doesnt work for transparent images because of the createImage (width,height);  The code is listed below:
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  
public static Image resize2(Image originalImage, int width, int height) { 
                          //if (height <= 0 || width <= 0)
                          //throw new Exception("ERROR_INVALID_ARGUMENT");
                          if (originalImage == null)
                                return Image.createImage(height, width);
                          int orig_h = originalImage.getHeight();
                          int orig_w = originalImage.getWidth();
                          if (orig_w == width && orig_h == height)
                                return originalImage;
                          int index;
                          int loc, oldloc = 0;
                          Image newImage = Image.createImage (width,height);
                          Graphics newImageG=newImage.getGraphics();
                          //long before = System.currentTimeMillis();
                          for (int i = 0; i < height; i++) {
                                for (int j = 0; j < width; j++) {
                                      //System.arraycopy(orig,index,newbuffer,loc,1);
                                    //  newbuffer[loc] = orig[index];
                                      newImageG.setClip (j,i,1,1);
                                      newImageG.drawImage (originalImage,j-(int) (j*orig_w/width),i-(int) (i*orig_h/height),0);
                                }
                          }
                          //System.out.println("time:"+(System.currentTimeMillis()-before));
                         //Image newImage = Image.createRGBImage(newbuffer, width, height, false);
                         // orig = null;
                         // newbuffer = null;
                         originalImage=null;      
                         System.gc(); //  
                          return newImage;
                    }
4  Java Game APIs & Engines / J2ME / cingular and cellmania mfinder on: 2005-04-08 23:30:10
I was wondering if anyone has ever used cingular/cellmania's mfinder program to distribute their games and what their experiences are with it.  You can view the program at this link http://cingulardeveloper.cellmania.com/documentation/mfinder_works.jsp;:4247ec31:a367ff30774fc9e8

Thanks
5  Java Game APIs & Engines / J2ME / Re: how do I rotate a filled rectangle on: 2005-04-08 23:24:48
You can find many sites out there that are devoted to this type of subject.  Here is a link that might be helpful: http://www.cs.brown.edu/people/scd/facts.html  

Also, your not going to be able to use sin and cos as there is no built in functions for that in midp.  What you can do is write a simple program in C or some other language to print out a list of sin and cos computations for each degree of rotation and then put those into your midp program and use it in a lookup table.
6  Java Game APIs & Engines / J2ME / Re: .png image bug on: 2005-04-08 23:14:52
I haven't been able to test on any nokia series 60 devices.  I have tried it with a series 60 emulator but I get the error "no such method getRGB"  I guessing the series 60 emulator I have is not midp 2.0.   Encase your wondering I have found a work around for the 4095 int limit.  The code is below, basically I resize strips of the image that are less than 4095 int big, then put them back together in one image.   It's takes more runtime memory, but doesnt use more than 4095 ints at one time.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
try {
 boardImg=Image.createImage ("/images/board.png");
 
 Image pieceImage,newImage;
 newImage=Image.createImage(boardWidth,boardHeight);
 Graphics newImageG=newImage.getGraphics();
 //board width =180, board height = 160
 int rgbdata[] = new int [180*(160/10)];
 for (p=0;p<10;p++) {
 boardImg.getRGB (rgbdata,0,180,0,p*(16),180,16);
 pieceImage=Image.createRGBImage (rgbdata,180,16,false);
 pieceImage=resize (pieceImage,boardWidth,(boardHeight/10));
 newImageG.drawImage (pieceImage,0,p*(boardHeight/10),0);
 pieceImage=null;
 System.gc();
 }
 boardImg=newImage;
 newImage=null;

 System.gc();
//boardImg=resize (boardImg,boardWidth,boardHeight);
 
      } catch (Exception e) {System.out.println ("Error loading images: "+e);}
 }


The more strips you create the more likely the image will be off somewhat.  If your interested in my resize code, I found it in the forums from a member named Yu You, I had written a similar resize code before but Yu You's was much faster than mine.  It is below.

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  
        public static Image resize(Image originalImage, int width, int height) { 
              //if (height <= 0 || width <= 0)
              //throw new Exception("ERROR_INVALID_ARGUMENT");
              if (originalImage == null)
                    return Image.createImage(height, width);
              int orig_h = originalImage.getHeight();
              int orig_w = originalImage.getWidth();
              if (orig_w == width && orig_h == height)
                    return originalImage;
              int[] orig = new int[orig_h * orig_w];
              originalImage.getRGB(orig, 0, orig_w, 0, 0, orig_w, orig_h);
              int index;
              int[] newbuffer = new int[height * width];
              int loc, oldloc = 0;
              //long before = System.currentTimeMillis();
              for (int i = 0; i < height; i++) {
                    for (int j = 0; j < width; j++) {
                          loc = i * width + j;
                          index = (int) (i * orig_h / height) * orig_w
                                      + (int) (j * orig_w / width);
                          //System.arraycopy(orig,index,newbuffer,loc,1);
                          newbuffer[loc] = orig[index];
                    }
              }
              //System.out.println("time:"+(System.currentTimeMillis()-before));
             Image newImage = Image.createRGBImage(newbuffer, width, height, false);
              orig = null;
              newbuffer = null;
              System.gc(); //  
              return newImage;
        }
7  Java Game APIs & Engines / J2ME / .png image bug on: 2005-04-08 04:55:12
I'm using Image.getRGB and Image.createRGBImage to resize images in midp2.0.  It works fine on the emulator.  But when I run the game on my palm tungsten E, with the ibm j9 kvm, I get a wierd error.  When the image is painted it shows a red square the size of the image.  I found that if I turn double-buffering off it paints the image correctly.  Also I found that the image is painted correctly with double buffering on, when I save the original image as a 24 bit rgb image.  When I save the image as a 8bit indexed color image, it works on the emulator, but not on the device.  Any ideas if this is a problem on other devices or how I can save the image as 8bit and still get it to display properly?
8  Java Game APIs & Engines / J2ME / Re: avoiding string creation on: 2005-04-07 21:35:30
I found the same problem in my game with printing the score was taking way to much of the % of cycles in the profiler.  Made a bit of code that would divided up the score into each 0 through 9 reprentation of each tens/hundred/thousands (so on) place and then print the string for that number from an array of strings that held the just the digits 0-9.  It works similar to the idea of painting a image of the number for each part of the score, but prints a string instead.
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  
numString[0]="0";
numString[1]="1";
numString[2]="2";
numString[3]="3";
numString[4]="4";
numString[5]="5";
numString[6]="6";
numString[7]="7";
numString[8]="8";
numString[9]="9";

g.drawString ("Score",scorePrint,bottom+3,0);
tempScore=score;
a=10;
numPlaces=0;
for (p=1;p<8;p++) {
      if (score-a<0) {
            numPlaces=p;
            p=9;
      }
      a=a*10;
}
for (p=1;p<numPlaces;p++) {
      k=1;
      a=0;
      for (t=0;t<numPlaces-p;t++) k=k*10;
      a=score/k;
      g.drawString (numString[a],scorePrint2+(p*FONT.stringWidth ("5")),bottom+3,0);
      score=score-(a*k);
}
g.drawString (numString[score],scorePrint2+(p*FONT.stringWidth ("5")),bottom+3,0);
score=tempScore;
9  Java Game APIs & Engines / J2ME / Re: Cpu speed required on: 2005-04-07 19:34:21
Wouldn't it be nice if some benchmark could tell you the number of byte codes per second a device runs at?  Then you would at least be able to set the emulator to run at that number of bytecodes per second and have some feel for how it will run on the device while you are developing the game.
10  Java Game APIs & Engines / J2ME / Re: Nice J2ME benchmark aimed at cpu characteristi on: 2005-04-07 00:37:26
If possible I would like to a see a feature that could tell you how many bytecodes per millisecond the devices run at.  It would help those who don't have the phones that others have tune the emulators to simulate those speeds.
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.

theagentd (20 views)
2014-10-25 15:46:29

Longarmx (53 views)
2014-10-17 03:59:02

Norakomi (47 views)
2014-10-16 15:22:06

Norakomi (35 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (69 views)
2014-10-14 00:35:47

TehJavaDev (61 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (46 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!