mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-10 02:23:23 +08:00
First chapter-specific progress breakout code; test to see if I can link these directly from article.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*******************************************************************
|
||||
** This code is part of Breakout.
|
||||
**
|
||||
** Breakout is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the CC BY 4.0 license as published by
|
||||
** Creative Commons, either version 4 of the License, or (at your
|
||||
** option) any later version.
|
||||
******************************************************************/
|
||||
#include "game.h"
|
||||
|
||||
Game::Game(unsigned int width, unsigned int height)
|
||||
: State(GAME_MENU), Keys(), Width(width), Height(height)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Game::Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Game::Update(float dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Game::ProcessInput(float dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Game::Render()
|
||||
{
|
||||
|
||||
}
|
||||
43
src/7.in_practice/3.2d_game/0.full_source/progress/2.game.h
Normal file
43
src/7.in_practice/3.2d_game/0.full_source/progress/2.game.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*******************************************************************
|
||||
** This code is part of Breakout.
|
||||
**
|
||||
** Breakout is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the CC BY 4.0 license as published by
|
||||
** Creative Commons, either version 4 of the License, or (at your
|
||||
** option) any later version.
|
||||
******************************************************************/
|
||||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
// Represents the current state of the game
|
||||
enum GameState {
|
||||
GAME_ACTIVE,
|
||||
GAME_MENU,
|
||||
GAME_WIN
|
||||
};
|
||||
|
||||
// Game holds all game-related state and functionality.
|
||||
// Combines all game-related data into a single class for
|
||||
// easy access to each of the components and manageability.
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
// game state
|
||||
GameState State;
|
||||
bool Keys[1024];
|
||||
unsigned int Width, Height;
|
||||
// constructor/destructor
|
||||
Game(unsigned int width, unsigned int height);
|
||||
~Game();
|
||||
// initialize game state (load all shaders/textures/levels)
|
||||
void Init();
|
||||
// game loop
|
||||
void ProcessInput(float dt);
|
||||
void Update(float dt);
|
||||
void Render();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user