Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How To Add Communication From My GUI To My Game Engine

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How To Add Communication From My GUI To My Game Engine

    Hi,

    I'm writing a tic tac toe game, however I want the logic to be in one class, TicTacToeEngine, and then GUI to be in a separate class, TicTacToeGUI. TicTacToeEngine has a TicTacToeGUI as a variable.

    What I want is for the engine to hold the information on the status of the game board and then the engine will call the functions in the GUI to re-draw the board. I want a player to click on the GUI where they want to place their piece and then the GUI will tell the engine what location the player has clicked on.

    This is where I am running into problems, however. I can't figure out how to get this message from my TicTacToeGUI to TicTacToeEngine. Does anyone have a suggestion on how to accomplish this?

    Thanks!


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How To Add Communication From My GUI To My Game Engine

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Where the user clicks on the GUI will contain an action listener. That listener will communicate to the 'engine' that the click was made. To see how this is done using what's known as a Model-View-Controller (MVC) architecture, search for "java mvc tutorial".

    Good luck. Come back with code posted correctly if you'd like more specific help.

Similar Threads

  1. Programming a game engine?
    By Tea.EarlGrey.Hot. in forum Java Theory & Questions
    Replies: 4
    Last Post: May 21st, 2014, 08:41 AM
  2. How do you add two actionListeners (in a GUI)?
    By ineedahero in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 12th, 2013, 10:32 PM
  3. lwjgl, gamedevelopment and game engine
    By atique in forum Java Theory & Questions
    Replies: 7
    Last Post: June 28th, 2013, 12:59 PM
  4. 2D Game Engine Development [Youtube Tutorials]
    By vanZeben in forum Java Programming Tutorials
    Replies: 6
    Last Post: May 23rd, 2013, 06:59 AM
  5. what are game engine
    By game06 in forum Java Theory & Questions
    Replies: 3
    Last Post: April 17th, 2013, 05:05 AM