GSoC 2018: Port the game to Vala
This is my attempt to port Five-or-More to Vala as a GSoC student.
The files inside the data directory have undergone only minor changes to make them suitable as templates, match the visual layout guidelines listed on developer.gnome.org or cut on the mixture between game logic and UI. The only new file is the gresource.xml which lists the resources needed to compile the game.
In the src directory there are:
- config.vapi - contains configuration variables
- board.vala - contains the structure of the game board and related logic, such as finding the shortest valid path between two cells; it also contains formal descriprion of a Cell and methods useful for cells (such as finding all neighbours of a given Cell)
- game.vala - incorporates all game logic such as: generating the next pieces to be rendered on the board after the ongoing move, filling the board with these pieces displayed in the queue, determining the path between two cells, if any, moving one object from the start cell to the destination one (both by mouse clicking and keyboard controls), matching same types of objects if there are five or more than five aligned, determining the score, determining if the game is over, as well as restarting the game.
- main.vala - this creates the application window and the settings for the game and ties callbacks for the buttons inside the app menu.
- next-pieces-widget.vala - the widget which contains the next objects to be rendered on the board once the current move is over
- piece-generator.vala - a queue of randomly generated objects to be displayed in the next-pieces-widget
- piece.vala - an object, whichs type (shape and/or colour) is determined by an id (the nth row inside the theme image)
- preferences-dialog.vala - callbacks to change the current information contained inside the settings
- theme-renderer.vala - currently only works for vector images; loads the theme from the vector image set in the settings; auxiliary methods such as rendering one object inside the image (its type and animation)
- view.vala - similar as the correspondence piece-generator - next-pieces-widget, view contains the methods to display the changes which occur in the game, thus keeping logic and view separated (game - view).
- window.vala - the app window, header bar hints and creation of high-scores tables.
Since the scoring logic has been changed, and the fast move feature was removed, the information contained inside the help page needed some updating.