Sign in to follow this  

My games does not work on Mac but works in Windows

This topic is 1180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Edited by warnexus

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

This topic is 1180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this