My games does not work on Mac but works in Windows

Started by
4 comments, last by Nicholas Kong 9 years, 7 months ago
Edit: solution has been found. See the latest reply of this thread. The fix is to add the canvas to the jpanel before presenting the jframe object on the screen. Apparently, The Mac is more sensitive about this. If I flipped the order of the code around, it would still work in Windows but not in Mac. Interesting find.

See above. I just started using a Mac computer. I have no idea where to start.
Advertisement

We're gonna need a bit more to go on here...

What do you mean when you say it "does not work"? Does it not compile? If not, what errors do you get that you don't understand? If it does compile, then does it not run? If not, how does it crash? Does it run mostly correctly except some small things are different? If so, what's different? What were you expecting?

Are you using a cross platform game engine that you expect to run on both Apple and Windows computers?

We're gonna need a bit more to go on here...

What do you mean when you say it "does not work"? Does it not compile? If not, what errors do you get that you don't understand? If it does compile, then does it not run? If not, how does it crash? Does it run mostly correctly except some small things are different? If so, what's different? What were you expecting?

Are you using a cross platform game engine that you expect to run on both Apple and Windows computers?

As a test, it complies. The frame window appears but it is all blank- no rendering. No problems is listed in Eclipse. I wrote this Java game for Windows and figured it would run the game in Mac but apparently not. No cross platform engine was used. I wrote my own animation system using standard Java libraries to render everything in the game. The rendering/drawing methods were provided by Standard Java.

Is it progressing internally? Can you step through the rendering on your system? When you step through it does anything render? What happens if you put temporary drawing code in there that immediately draws? Can you eliminate issues like double buffering, streaming, or un-accelerated software-based rendering?
Think different
(Sorry couldn't resist)

Solution:

Okay I figured out what was going on.

panel.add(this);
frame.setVisible(true);

If I flipped the order of these two code, the game won't appear in Mac. However, if I changed the order in Windows, the game will appear. Interesting finding!

Apparently I have to add the canvas to the panel before I allow the frame to presents itself.

Holy cow! So many down votes...

This topic is closed to new replies.

Advertisement