2021-10-15 16:43:09 +00:00
|
|
|
// Copyright (c) Jon Thysell <http://jonthysell.com>
|
|
|
|
// Licensed under the MIT License.
|
|
|
|
|
2021-12-07 19:07:28 +00:00
|
|
|
/**
|
|
|
|
* @file GameWindow.h
|
|
|
|
*
|
|
|
|
* This file provides the GameWindow type, which, as MacLO is essentially
|
|
|
|
* played entirely within one Window, essentially manages the entire game.
|
|
|
|
* GameWindow keeps track of the core GameEngine as well as the current scene,
|
|
|
|
* which it calls to handle rendering and to handle user interaction based
|
|
|
|
* on the state of both.
|
|
|
|
*/
|
|
|
|
|
2021-10-15 16:43:09 +00:00
|
|
|
#ifndef GAMEWINDOW_H
|
|
|
|
#define GAMEWINDOW_H
|
|
|
|
|
|
|
|
#include "MacCommon.h"
|
2021-11-22 00:29:38 +00:00
|
|
|
#include "WindowBuffer.h"
|
2021-10-16 00:29:07 +00:00
|
|
|
#include "GameEngine.h"
|
2021-12-12 23:45:28 +00:00
|
|
|
#include "GameSave.h"
|
2021-11-05 02:54:28 +00:00
|
|
|
#include "Bitmaps.h"
|
2021-11-10 01:01:34 +00:00
|
|
|
#include "Sounds.h"
|
2021-10-31 22:13:51 +00:00
|
|
|
#include "Scenes.h"
|
2021-10-15 16:43:09 +00:00
|
|
|
|
2021-12-07 19:07:28 +00:00
|
|
|
/** The background pattern of the window. */
|
2021-11-05 02:54:28 +00:00
|
|
|
#define WindowPattern black
|
2021-10-22 18:32:19 +00:00
|
|
|
|
2021-12-07 19:07:28 +00:00
|
|
|
/** Struct containing everything the game needs. */
|
2021-11-05 02:54:28 +00:00
|
|
|
typedef struct sGameWindow
|
2021-10-15 16:43:09 +00:00
|
|
|
{
|
2021-12-01 02:38:36 +00:00
|
|
|
WindowPtr Window;
|
|
|
|
WindowBuffer WindowBuffer;
|
|
|
|
GameEngine Engine;
|
2021-12-12 23:45:28 +00:00
|
|
|
GameSave GameSave;
|
2021-12-01 02:38:36 +00:00
|
|
|
Bitmaps Bitmaps;
|
|
|
|
Sounds Sounds;
|
|
|
|
SceneId CurrentSceneId;
|
|
|
|
TitleScene TitleScene;
|
|
|
|
LevelSelectScene LevelSelectScene;
|
|
|
|
PlayScene PlayScene;
|
|
|
|
LevelEndScene LevelEndScene;
|
|
|
|
GameEndScene GameEndScene;
|
2021-10-15 16:43:09 +00:00
|
|
|
} GameWindow;
|
|
|
|
|
2021-12-07 19:07:28 +00:00
|
|
|
/**
|
|
|
|
* Initializes the GameWindow.
|
|
|
|
* @param pGameWindow The GameWindow.
|
|
|
|
*/
|
2021-10-16 00:29:07 +00:00
|
|
|
void GameWindow_Init(GameWindow *pGameWindow);
|
2021-12-07 19:07:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws the GameWindow.
|
|
|
|
* @param pGameWindow The GameWindow.
|
|
|
|
* @param fullRefresh Whether or not the whole screen needs to be redrawn.
|
|
|
|
*/
|
2021-10-22 18:32:19 +00:00
|
|
|
void GameWindow_Draw(const GameWindow *pGameWindow, bool fullRefresh);
|
2021-12-07 19:07:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles clicks on the GameWindow.
|
|
|
|
* @param pGameWindow The GameWindow.
|
|
|
|
* @param pPosition The local position where the click occured.
|
|
|
|
*/
|
2021-10-20 16:34:31 +00:00
|
|
|
void GameWindow_Click(GameWindow *pGameWindow, const Point *pPosition);
|
2021-10-15 16:43:09 +00:00
|
|
|
|
2021-12-07 19:07:28 +00:00
|
|
|
/**
|
|
|
|
* Changes the GameWindow to the given scene.
|
|
|
|
* @param pGameWindow The GameWindow.
|
|
|
|
* @param sceneId The new scene.
|
|
|
|
*/
|
2021-10-31 22:13:51 +00:00
|
|
|
void GameWindow_SetScene(GameWindow *pGameWindow, const SceneId sceneId);
|
2021-12-07 19:07:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Activates the GameWindow.
|
|
|
|
* @param pGameWindow The GameWindow.
|
|
|
|
*/
|
2021-10-31 22:13:51 +00:00
|
|
|
void GameWindow_Show(const GameWindow *pGameWindow);
|
|
|
|
|
2021-12-16 20:57:00 +00:00
|
|
|
/**
|
|
|
|
* Toggles whether sound is enabled/disabled for the GameWindow.
|
|
|
|
* @param pGameWindow The GameWindow.
|
|
|
|
*/
|
|
|
|
void GameWindow_ToggleSound(GameWindow *pGameWindow);
|
|
|
|
|
2021-12-07 19:07:28 +00:00
|
|
|
/**
|
|
|
|
* Resets the level scores of the GameWindow.
|
|
|
|
* @param pGameWindow The GameWindow.
|
|
|
|
*/
|
2021-12-01 02:38:36 +00:00
|
|
|
void GameWindow_ClearScores(GameWindow *pGameWindow);
|
|
|
|
|
2021-10-15 16:43:09 +00:00
|
|
|
#endif
|