Git Product home page Git Product logo

java-awt-solitaire-game's Introduction

Java-AWT-Solitaire-Game

Solitaire game example using Java AWT. Includes basic game logic, localization and a save/load system.

Screenshots

Screenshot-solitaire

Program architecture

The program main class is Game, which contains the main function and also creates singular instances of the GUI and Engine.

The game, as it should, does not use any global variables. All variables are members of some class. The GUI instances can access public members and methods from the Engine instance because the Engine is passed as an argument to the GUI’s constructor.

The Engine class contains functions which enable the interaction between one or two Piles.

The GUI class, except for display all user interface elements and positioning the game objects, it also handles all the interactions done by the user using the mouse or keyboard input.

The Pile class is a container class which hold zero, one or more Cards. This class contains solitairespecific logic to make sure only legal moves can be performed.

The Card class holds information about a single playing card (including the image) and the Deck class contains a list of 52 cards.

To easily handle the dragging event, when a drag event is started the pile that was clicked gets split into two piles (one that remains still, and another temporarily pile that is absolute positioned). The temporarily file gets merged with another pile when the drag event is complete, or is appended back to the original pile.

The GUI implementation uses the root content pane to display all game content and the default frame layered pane to display the top menu bar. The layered pane is also used to display the absolutepositioned temp pile while it is being dragged.

License

cc-by

Licensees may copy, distribute, display and perform the work and make derivative works and remixes based on it only if they give the author or licensor the credits (attribution) in the manner specified by these

java-awt-solitaire-game's People

Contributors

cristy94 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.