-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
146 changed files
with
1,398 additions
and
7,639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
#include <Dynamo.hpp> | ||
|
||
int main() { | ||
Dynamo::ApplicationConfiguration config; | ||
config.title = "Hello, world!"; | ||
config.width = 640; | ||
config.height = 480; | ||
config.asset_directory = "../assets/"; | ||
Dynamo::ApplicationSettings settings; | ||
settings.title = "Hello, world!"; | ||
settings.window_width = 640; | ||
settings.window_height = 480; | ||
settings.root_asset_directory = "../assets/"; | ||
|
||
Dynamo::Application app(config); | ||
Dynamo::Application app(settings); | ||
while (app.is_running()) { | ||
app.run(); | ||
app.update(); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "Application.hpp" | ||
|
||
namespace Dynamo { | ||
Application::Application(const ApplicationSettings &settings) { | ||
_display = std::make_unique<Display>(settings.title, | ||
settings.window_width, | ||
settings.window_height); | ||
_jukebox = std::make_unique<Sound::Jukebox>(); | ||
} | ||
|
||
bool Application::is_running() const { return _display->is_open(); } | ||
|
||
Display &Application::get_display() { return *_display; } | ||
|
||
Input &Application::get_input() { return _display->get_input(); } | ||
|
||
Clock &Application::get_clock() { return _clock; } | ||
|
||
Sound::Jukebox &Application::get_jukebox() { return *_jukebox; } | ||
|
||
void Application::update() { | ||
// Update subsystems | ||
_display->get_input().poll(); | ||
|
||
// Tick | ||
_clock.tick(); | ||
} | ||
} // namespace Dynamo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#pragma once | ||
|
||
#include <functional> | ||
#include <string> | ||
|
||
#include "./Sound/Jukebox.hpp" | ||
#include "Clock.hpp" | ||
#include "Display.hpp" | ||
|
||
namespace Dynamo { | ||
/** | ||
* @brief Application setup options. | ||
* | ||
*/ | ||
struct ApplicationSettings { | ||
/** | ||
* @brief Application title. | ||
* | ||
*/ | ||
std::string title; | ||
|
||
/** | ||
* @brief Width of the display window. | ||
* | ||
*/ | ||
unsigned window_width; | ||
|
||
/** | ||
* @brief Height of the display window. | ||
* | ||
*/ | ||
unsigned window_height; | ||
|
||
/** | ||
* @brief Root asset directory. | ||
* | ||
*/ | ||
std::string root_asset_directory; | ||
}; | ||
|
||
/** | ||
* @brief Dynamo Application. | ||
* | ||
*/ | ||
class Application { | ||
std::unique_ptr<Display> _display; | ||
std::unique_ptr<Sound::Jukebox> _jukebox; | ||
|
||
Clock _clock; | ||
|
||
public: | ||
/** | ||
* @brief Initialize a new Application. | ||
* | ||
* @param settings | ||
*/ | ||
Application(const ApplicationSettings &settings); | ||
|
||
/** | ||
* @brief Check if the application is running. | ||
* | ||
* @return true | ||
* @return false | ||
*/ | ||
bool is_running() const; | ||
|
||
/** | ||
* @brief Get the display. | ||
* | ||
* @return Display& | ||
*/ | ||
Display &get_display(); | ||
|
||
/** | ||
* @brief Get the input handler. | ||
* | ||
* @return Input& | ||
*/ | ||
Input &get_input(); | ||
|
||
/** | ||
* @brief Get the clock. | ||
* | ||
* @return Clock& | ||
*/ | ||
Clock &get_clock(); | ||
|
||
/** | ||
* @brief Get the audio engine. | ||
* | ||
* @return Sound::Jukebox& | ||
*/ | ||
Sound::Jukebox &get_jukebox(); | ||
|
||
/** | ||
* @brief Update the application state. | ||
* | ||
*/ | ||
void update(); | ||
}; | ||
|
||
/** | ||
* @brief Application reference. | ||
* | ||
*/ | ||
using ApplicationRef = std::reference_wrapper<Application>; | ||
} // namespace Dynamo |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.