Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
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: Enum in Java 6 on eclipse on: 2007-11-05 15:40:31
Yup that did the trick, it was being compiled at 1.42 level which is funny because I'd specified version 6 in other places and when I created the project. Thanks you saved me loads of headaches in the future.
2  Game Development / Newbie & Debugging Questions / Enum in Java 6 on eclipse on: 2007-11-02 12:08:40
I'm to be having a bit of a problem implementing enums in Java 6 on eclipse the actual code I've been trying to implement is actually from Java 5 (and I know it is correct because it compiled and ran in version 5) however java 6 rejects it. I've even tried putting in really simple enum declarations from example books and they also bomb. Any ideas?
3  Game Development / Game Mechanics / Re: Phys2D joint on: 2007-08-28 23:17:34
The results with the fixed joint are better than what I had before but still not perfect (namely vibration which can be annoying when the screen is scrolling), I'll try and play around with things over the next few days and tell you guys how it worked out. Thanks for the help so far.
4  Game Development / Game Mechanics / Re: Phys2D joint on: 2007-08-21 09:32:44
I need them to act as though they were glued together with super glue as in to act as a single body. So whatever the box does the circle will do.

Just an after thought. I suspect the solution would be to add some forces to counter those making it move around but thinking about physics is not a good idea for me as a few attempts I have made will prove. Any thoughts?
5  Game Development / Game Mechanics / Phys2D joint on: 2007-08-20 19:58:19
Does any one have any idea on how I can have 2 shapes stick together so that if the object behind (a box) moves it will push the other (a circle) with their positions relative to eachother staying the same, at the moment I have tried using joints but the circle keeps rotating around the square when it moves.   

NB:  the world is a  top down view, like the pool table demo

Thanks
6  Java Game APIs & Engines / Java 2D / Scoller (like on news channels) object in swing? on: 2007-06-29 20:13:47
Very quick question, is there any type of scroller object that I can supply a string (and possibly an ImageIcon) and have it scroll across the screen like those lovely things we see at the bottom of the screen on news channels. I'm hoping for a stock (i.e. from sun) Swing object but one created by a third party will also be cool.

Thanks
7  Game Development / Shared Code / Re: (another) Translucent window on: 2007-06-07 19:50:00
Nice work JuddMan looks great!!
I've been having a problem and you might be the person to help me, do you know how to make a color chooser translucent (well the background anyway) ? I'm talking about the panels on a color chooser that isn't displayed in a JDialog.
8  Java Game APIs & Engines / Java 2D / Re: Look And Feel (Java 6) on: 2007-06-07 18:02:13
CaptainJester
--------------------
JColorChooser isn't a top level container is it? I'm displaying it in a jpanel that I've "decorated " to fit in with the look of my game and NOT in a JDialog which might be what you are talking about.

CommanderKeith
--------------------------
I'm pretty sure I'm not gonna use substance or liquid (although I might check out ) for the look and feel I really just need the swing components to be of dark colors (and in some cases translucent) that's why I initially thought substance would be a good idea (but clearly it wasn't). I've now come to terms with the fact that I'm just gonna have to change the colors of them where i can.



9  Java Game APIs & Engines / Java 2D / Re: Look And Feel (Java 6) on: 2007-06-02 23:51:50
Thanks for the replies so far. I looked at liquid, and although there was no flicker it did have a lot of the same problems as substance and seemed to be a lot less "tweakable" as Erikd says.

So I'm probably gonna keep struggling with the default look and feel, but does anyone know how to customise scrollbars and make the colorchooser transparent?
10  Java Game APIs & Engines / Java 2D / Look And Feel (Java 6) on: 2007-05-31 13:47:33
I just switched my program from Java 1.42 to Java 6 because I wanted to take advantage of Substance Look and Feel (is 5.0 and up only). After sorting out a few things it didn't like in my code I got everything up and running and then plugged in Substance, but it didn't go together very well -

a) There was terrible flicker (I suppose substance doesn't like direct rendering)
b) It drew it's own button images behind mine
c) I got deadlocks on comboBoxes (never seen that before)
d) Other more minor stuff

So I decided to just change the gui stuff by myself with UIManager since just changing  a few imageIcons and colors for the objects I'm using (JComboBox, JFormattedTextField, ScrollBar, JSpinner JColorChooser and a few others) will give me the results I need. I've had a few problems so far -

1) Java 6 draws this annoying light blue border around my comboboxes and I've tried everything but can't get rid of it
2) I've created a color chooser with only the first panel (the palette array thing) and can't get it to make it transparent

1  
2  
3  
4  
5  
      AbstractColorChooserPanel panels[] = colorChooser.getChooserPanels();
      panels[0].setOpaque(false);
      panels[0].setBackground(new Color(0f,0f,0f,0f));
      AbstractColorChooserPanel panels2[] = {panels[0]};
      colorChooser.setChooserPanels(panels2);


And

1  
      UIManager.put("ColorChooser.background ", new Color(0f,0f,0f,0f));


3) Having trouble changing the color of the scrollbar including buttons and the color of the arrows on the buttons

That's about all I can think of for now. Thanks
11  Java Game APIs & Engines / Java 2D / Re: JDialog Problems on: 2007-05-26 19:20:08
Almost forgot about this. Ended up just making a loop that sets everything to "disabled before" I show the JPanel and then "enabled" when I hide it and it worked perfectly.
Thanks again Kova!!
12  Java Game APIs & Engines / Java 2D / Re: JDialog Problems on: 2007-05-01 15:11:53
Sounds great I'll try that, thanks!!
13  Java Game APIs & Engines / Java 2D / JDialog Problems on: 2007-04-30 11:35:00
I'm currently using modal JDialogs ro give messages to users and they work well but they're a bit ugly and I'm not sure I can customise them (no border, background image, my own images for buttons) and if I can I imagine it's really difficult because stuff like setDecorated(false) just make my app hang. Is there anyway I can use a JPanel for the same thing (i.e. making it modal)?
14  Game Development / Game Mechanics / Re: Which physics engine? on: 2007-02-13 10:21:19
Thanks for the quick replys everyone.

I guess I didn't give enough information in my original post (sorry bout that) so I'll try and clear up everything:

a) I will need 3 dimensions but the game is done in 2D, with the X and Y axies representing left/right and backwards/forwards respectively, up and down being represented by going in and out of the screen i.e. faked by moving shadows - however the calculations are done as normal. So I won't be needing any scene-graph or anything like that. In short the game is 2D not 3D.

b) I've pretty much ruled out ODEJava because as a noob some unexplainable error (that's not even my fault) might be too much for me to recover from and I really want something that's all Java.

c) Is there anywhere I can just get the JOODE JAR because I have no idea how to use subversion (even though I really should by now), ahem!! Embarrassed

That should be about it (for now) , thanks!!
15  Game Development / Game Mechanics / Which physics engine? on: 2007-02-11 05:30:43
I need a physics engine for my first full game but I don't know which one to choose. The ideal engine doesn't have to be very sophisticated, in fact I would prefer a simple one that I can get started with quickly. Major pluses would be documentation or examples/tutorials on the web, small jar size and speed over accuracy.

I looked at JOODE but there were no documentation or docs and it looked a bit incomplete and possibly buggy (I don't know why but I wasn't filled with confidence by what was on its website).

Any suggestions?

P.S. - The game is a top down sports sim so i need 3 dimensions and I'll be dealing mainly with a sphere
16  Java Game APIs & Engines / Java 2D / Re: JButtons not responding on: 2007-01-11 23:52:31
I read somewhere that mixing AWT and Swing is a 'big no no' so I decided to ditch the canvas and just use a JPanel, I have to translate my Graphics2D object a few times but at least everything works perfectly now (read a few other peoples threads for pointers). I would've liked to use a canvas but hey, what can you do? Thanks for everyone's help, with any luck you'll all be playing my first full game very soon.
17  Java Game APIs & Engines / Java 2D / Re: JButtons not responding on: 2007-01-08 17:52:03
In fact just out of interest how do you guys make your menus? By this I mean  how do you arrange everything and what sort of objects do you use, because I'm starting to think that I'm going about this the wrong way or at least the long way.
18  Java Game APIs & Engines / Java 2D / Re: JButtons not responding on: 2007-01-08 17:44:03
I can now add things directly to the contentPane and call contentPane.paintComponents(), it turns out setOpaque(false) didn't work as I'd expected it to but setBackground(new Color(0f,0f,0f,0f)) (transparent background colour) did the trick, weird (can anyone explain this). No change on the main problem with the buttons though.


KEV
1)I already have a sleep() thingy, I tried different (larger) values but no change.

2)menuSystem() is called by my main method because it simply provides a way of setting a few options before the main game is started i.e. it returns a few objects for game().

KOVA
I'll make one and upload it for you guys to check but I'll have to do a bit of editing (there's a lot of fluff that needs to be cut out).
19  Java Game APIs & Engines / Java 2D / Re: JButtons not responding on: 2007-01-07 17:11:49
Woah that was quick, I'm pretty sure that's not the problem but I'll try it anyway. I'm really desperate right now. Thanks for the help so far guys.
20  Java Game APIs & Engines / Java 2D / Re: JButtons not responding on: 2007-01-07 16:35:27
Thing is, the buttons were working perfectly before (drawn by calling paintComponents(g) on my JFrame ) but my program was a JPanel so I had all sorts of issues with things being drawn underneath the JFrame's title bar and such. The thing is if I try to call the paintComponents() method woth my canvas I get a huge gray block although I can still see my background image around the edges (because the block is slightly smaller than the drawing surface) I don't know if this bcause of some shortcomings in the canvas class or my coding.

Here's some code if it helps:

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  
public class MyGame extends Canvas implements Stage
{
   private JFrame gameWindow;
   private JPanel contentPane;
   private JPanel activeLayer;
   private BufferStrategy strategy;


   public MyGame()
   {
      quitGame = false;
      spriteCache = new SpriteCache();
      gameWindow = new JFrame("Soccer");
      contentPane = (JPanel)gameWindow.getContentPane();
      activeLayer = new JPanel();
      activeLayer.setBounds(0,30,Stage.WIDTH,Stage.HEIGHT);
      activeLayer.setLayout(new FlowLayout(FlowLayout.LEFT));
      setBounds(0,0,Stage.WIDTH,Stage.HEIGHT);
      //Configure the contentPane
      contentPane.setOpaque(false);
      contentPane.setLayout(null);
      contentPane.add(this);
      contentPane.setPreferredSize(new Dimension(Stage.WIDTH,Stage.HEIGHT));
      //Configure the main Window
      gameWindow.setBounds(0,0,Stage.WIDTH,Stage.HEIGHT);
      gameWindow.setVisible(true);
      gameWindow.addWindowListener( new WindowAdapter()
      {
         public void windowClosing(WindowEvent e)
         {
            System.exit(0);
         }
      });
      gameWindow.setResizable(false);
      createBufferStrategy(2);
      strategy = this.getBufferStrategy();
      requestFocus();
      NullRepaintManager.install();
   }


   public void menuSystem()
   {
      Graphics2D g = (Graphics2D)strategy.getDrawGraphics();
   
      MenuManager menuManager = new MenuManager(match, resources.getMenuGraphics());
      activeLayer.setOpaque(false);
      //This returns the JPanel containing the buttons
      activeLayer.add(menuManager.getMenu(0));
      contentPane.setOpaque(false);
      contentPane.add(activeLayer);
      gameWindow.validate();
      boolean doDraw = true;
      while(doDraw)
      {
         g.drawImage((BufferedImage)resources.getMenuGraphics().get(0),0,-29,null);
         menuManager.paintMenu(g);
         activeLayer.paintComponents(g);
         strategy.show();
      }
   
   }


I cut a few methods out of the code because they're irrelevant and I doubt many people would appreciate reading through 400+ lines.
21  Java Game APIs & Engines / Java 2D / JButtons not responding on: 2007-01-07 01:46:44
My program extends Canvas (for buffering purposes), I put this into the JFrame's contentPane and draw everything myself (using the NullRepaintManager from David Brackeen's book) . I have made several JButtons in a JPanel which I put into the contentPane and then to draw them I call paintContents(g) on the JPanel because for some reason if I call contentPane.paintContents(g) I get a gray screen even though I've set  setOpaque(false). Everything seems great until I try to use the thing because the buttons don't respond at all, they don't even register that the cursor os over them i.e. neither the image icon nor the cursor image change and clicking them doesn't do anything either.

I'm a bit of a noob so I'm sure it's something really simple, can anyone help?
22  Java Game APIs & Engines / Java 2D / Re: IndexColorModel Help needed by eager student on: 2006-07-15 21:12:13
/******************************************************************************************************************************/
/*This code creates the color model*/
 
                byte[] reds = new byte[16];
      byte[] greens = new byte[16];
      byte[] blues = new byte[16];

      reds[0] = (byte)254; greens[0] = (byte)1; blues[0] = (byte)24;
      reds[1] = (byte)28; greens[1] = (byte)174; blues[1] = (byte)112;
      reds[2] = (byte)198; greens[2] = (byte)198; blues[2] = (byte)198;
      reds[3] = (byte)254; greens[3] = (byte)1; blues[3] = (byte)24;
      reds[4] = (byte)28; greens[4] = (byte)174; blues[4] = (byte)112;
      reds[5] = (byte)28; greens[5] = (byte)174; blues[5] = (byte)112;
      reds[6] = 0; greens[6] = 0; blues[6] = 0;
      reds[7] = 0; greens[7] = 0; blues[7] = 0;
      reds[8] = 0; greens[8] = 0; blues[8] = 0;
      reds[9] = 0; greens[9] = 0; blues[9] = 0;
      reds[10] = 0; greens[10] = 0; blues[10] = 0;
      reds[11] = 0; greens[11] = 0; blues[11] = 0;
      reds[12] = 0; greens[12] = 0; blues[12] = 0;
      reds[13] = 0; greens[13] = 0; blues[13] = 0;
      reds[14] = 0; greens[14] = 0; blues[14] = 0;
      reds[15] = 0; greens[15] = 0; blues[15] = 0;

      IndexColorModel cm = new IndexColorModel(4, 16, reds, greens, blues);

               g.drawImage(remodelSprite("imageName.png", cm), 55, 69,this);/


/*****************************************************************************************************************/
/*This is the method that the last line above calls which creates the new image with the new colormodel*/

public BufferedImage remodelSprite(String name, IndexColorModel cm)
{
         BufferedImage img = (BufferedImage)sprites.get(name);
         if (img == null)
               {
                  img = loadImage("images/"+name);
                  sprites.put(name,img);
                  System.out.println("The image was null");
               }
         BufferedImage newImage = new BufferedImage(cm, img.getRaster(), false, null);
         
         return newImage;

}/



Thats should be about it, sorry it's a bit messy but it I couldn't fin the old code so I has to rewrite it all, still it gives you the gist.

Oh yeah and I only needed about 5 colours so I skipped the rest, obviously you shouldn't.
23  Java Game APIs & Engines / Java 2D / Re: IndexColorModel Help needed by eager student on: 2006-07-08 19:27:58
Whoops, I actually worked out how to do this a while ago but I didn't come on here cos I was tied up with exams and such.


The code:

1) loads the original image

2)Creates a new indexColorModel using 16 sets of RGB values
specified somewhere (eventually this will be from some XML file but for now it's
still hard coded). This new colour model has 16 x 3 entries i.e. one for each colour
in the array and which is further divided into 3 for RED/GREEN/BLUE values.

3)The new colour model is applied to our image

4)Voila

Well sort of, there's a bit of a problem with transparencies, because I don't know how to tell it that a certain colour is a trasparent.

I'll post the code here for people to check out and use if they want, but I'll have to do it tomorrow because I'll have to find the version of my code with that in it.


24  Java Game APIs & Engines / Java 2D / Re: IndexColorModel Help needed by eager student on: 2006-04-20 10:35:27

Thanks for the replys guys I was beginning to lose faith. I'd expected most of what you're telling me but I think I'll try it out anyway just to see how things work out and I've reduced the images to 16 colours so that should help in terms of speed.

rdcarvallo please post your code I'd really appreciate that.

Another solution I was thinking of would be to create a huge "sprite-sheet" (if that's the correct name) with all the frames of animation in one image and then change the pallete at load time before putting it into memory instead of doing every frame at once. Would this work?
25  Java Game APIs & Engines / Java 2D / IndexColorModel Help needed by eager student on: 2006-03-28 17:55:35
I've been "lurking" around these forums for a while and finally have a problem that I can't find the answer to.

My Problem
------------------

I'm making a sports game in which the player sprites contain no more than about 16 colours (though at the moment they're all 256 colour PNGs) and are BufferedImages.  Eventually the game will have different players and teams so I need to find a way to change the pallette for each player as required.

The solution I was considering
--------------------------------------------

I plan to have an array in in each instance of team with the colors of the Shirts/shorts/socks and another in every instance of player with colours for skin and hair. When a player is drawn the values from the two arrays will be read and used by some class (IndexColourModel?Huh)  to replace all instances of colour A(original) with Colour B(from array) and All instances of Colour C(original) with Colour D(from array) e.t.c.

I've spent some time looking up solutions on this forum and now think that the IndexColorModel class could hold the key. I looked on the SUN pages and even borrowed a book on "2d Graphics in Java" but I still don't understand how to use it. Please can someone give me an example (even a very simple one) that will allow me to create/edit a pallette or even better use one created in a program like PaintShop Pro.

This is very important for my "Project" because if it's not going to work or if it's too slow(as I suspect it will be), I'll have to think about whether I should be doing something else, which will be a pity.

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

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (51 views)
2014-12-03 16:27:13

CopyableCougar4 (48 views)
2014-11-29 21:32:03

toopeicgaming1999 (115 views)
2014-11-26 15:22:04

toopeicgaming1999 (103 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

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