Remove node class
This commit is contained in:
parent
493ab7eb6e
commit
a5380c4417
18
TODO.md
18
TODO.md
|
@ -1,21 +1,18 @@
|
||||||
# Hibis Engine - Feature TODOs
|
# Hibis Engine - Feature TODOs
|
||||||
## Core
|
## Core Module
|
||||||
- [ ] BetterC compatibility
|
- [ ] BetterC compatibility
|
||||||
- [ ] Texture loading
|
- [ ] Texture loading
|
||||||
- [ ] Model loading
|
- [ ] Model loading
|
||||||
- [ ] Base Renderer class
|
- [ ] Base Renderer class
|
||||||
- [ ] Base Physics class
|
- [ ] Base Physics class
|
||||||
- [ ] Base Node class
|
- [ ] Figure out how scenes should be handled
|
||||||
- [ ] Base UI Node class
|
|
||||||
- [ ] Base Audio Playback Node class
|
|
||||||
- [ ] Split other sections into seperate libraries (renderers, physics)
|
- [ ] Split other sections into seperate libraries (renderers, physics)
|
||||||
## Audio
|
## Audio Module
|
||||||
- [ ] OGG and WAV support (do first)
|
- [ ] OGG and WAV support (do first)
|
||||||
- [ ] MP3 (later)
|
- [ ] MP3 (later)
|
||||||
- [ ] Audio playing nodes
|
## Hibis UI (NEEDS A NAME)
|
||||||
## Hibis UI (NEED A NAME)
|
|
||||||
- [ ] GUI creation
|
- [ ] GUI creation
|
||||||
- [ ] Text Object (rendering via SDL2_TTF (RSDL) or FreeType2 (EVERYTHING ELSE))
|
- [ ] Text Object (rendering via FreeType2)
|
||||||
## RGLCore (2D AND 3D)
|
## RGLCore (2D AND 3D)
|
||||||
- [X] Window creation
|
- [X] Window creation
|
||||||
- [ ] Renderer creation
|
- [ ] Renderer creation
|
||||||
|
@ -35,6 +32,9 @@
|
||||||
## Hibis Physics (NEED A NAME)
|
## Hibis Physics (NEED A NAME)
|
||||||
- [ ] Physics Shape creation
|
- [ ] Physics Shape creation
|
||||||
- [ ] Collision via raycasting
|
- [ ] Collision via raycasting
|
||||||
- [ ] Option to *allow* for Physics Shapes to be able to be drawn (on by default, both compile time and run time, turn off at compile time via version(`-version=NoPhysShapeDraw`?))
|
- [ ] Option to *allow* for Physics Shapes to be able to be drawn (on by default, both compile time and run time, turn off at compile time via a flag (`-DNoPhysShapeDraw=1`?))
|
||||||
## Examples
|
## Examples
|
||||||
|
- [ ] Example: UI test
|
||||||
- [ ] Example Game: Megaman clone
|
- [ ] Example Game: Megaman clone
|
||||||
|
- [ ] Stress test using sprites
|
||||||
|
- [ ] Stress test using models
|
||||||
|
|
|
@ -25,36 +25,24 @@ namespace hibis {
|
||||||
//watch.stop();
|
//watch.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::runNodeProcesses() {
|
float Engine::calculateDelta(bool isPhysics) {
|
||||||
TODO("check if delta calc is correct")
|
|
||||||
TODO("get workaround for MSVC being fucking stupid (std::chrono + std::this_thread)")
|
|
||||||
const std::chrono::time_point<std::chrono::steady_clock> current = std::chrono::steady_clock::now();
|
const std::chrono::time_point<std::chrono::steady_clock> current = std::chrono::steady_clock::now();
|
||||||
auto delta = std::chrono::duration<float>(current - mPreviousProcessTick);
|
if (isPhysics) {
|
||||||
|
auto delta = std::chrono::duration<float>(current - mPreviousPhysicsProcessTick);
|
||||||
|
|
||||||
for (Node* node : mNodeList) {
|
return delta.count();
|
||||||
node->process(delta.count());
|
} else {
|
||||||
|
auto delta = std::chrono::duration<float>(current - mPreviousProcessTick);
|
||||||
|
|
||||||
|
return delta.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
mPreviousProcessTick = std::chrono::steady_clock::now();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::runNodePhysicsProcesses() {
|
void Engine::updateDelta(bool isPhysics) {
|
||||||
const std::chrono::time_point<std::chrono::steady_clock> current = std::chrono::steady_clock::now();
|
if (isPhysics) {
|
||||||
auto delta = std::chrono::duration<float>(current - mPreviousProcessTick);
|
mPreviousPhysicsProcessTick = std::chrono::steady_clock::now();
|
||||||
|
} else {
|
||||||
for (Node* node : mNodeList) {
|
mPreviousProcessTick = std::chrono::steady_clock::now();
|
||||||
node->physicsProcess(delta.count());
|
|
||||||
}
|
|
||||||
|
|
||||||
mPreviousProcessTick = std::chrono::steady_clock::now();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Engine::drawNodes() {
|
|
||||||
TODO("check if this works")
|
|
||||||
for (Node* node : mNodeList) {
|
|
||||||
if (Drawable* drawNode = (Drawable*)&node) {
|
|
||||||
drawNode->draw(mRenderer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include "../renderer/renderer.hpp"
|
#include "../renderer/renderer.hpp"
|
||||||
#include "../callback.hpp"
|
#include "../callback.hpp"
|
||||||
#include "../node/node.hpp"
|
|
||||||
|
|
||||||
namespace hibis {
|
namespace hibis {
|
||||||
class Engine {
|
class Engine {
|
||||||
|
@ -14,11 +13,9 @@ namespace hibis {
|
||||||
Engine(Renderer* renderer, LoggerCallback logger);
|
Engine(Renderer* renderer, LoggerCallback logger);
|
||||||
~Engine();
|
~Engine();
|
||||||
|
|
||||||
void runNodeProcesses();
|
float calculateDelta(bool isPhysics);
|
||||||
|
|
||||||
void runNodePhysicsProcesses();
|
void updateDelta(bool isPhysics);
|
||||||
|
|
||||||
void drawNodes();
|
|
||||||
|
|
||||||
const char* getEngineVersion();
|
const char* getEngineVersion();
|
||||||
|
|
||||||
|
@ -29,7 +26,6 @@ namespace hibis {
|
||||||
std::chrono::time_point<std::chrono::steady_clock> mPreviousProcessTick;
|
std::chrono::time_point<std::chrono::steady_clock> mPreviousProcessTick;
|
||||||
std::chrono::time_point<std::chrono::steady_clock> mPreviousPhysicsProcessTick;
|
std::chrono::time_point<std::chrono::steady_clock> mPreviousPhysicsProcessTick;
|
||||||
|
|
||||||
std::vector<Node*> mNodeList;
|
|
||||||
LoggerCallback mLoggerCallback;
|
LoggerCallback mLoggerCallback;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace hibis {
|
|
||||||
class Node {
|
|
||||||
public:
|
|
||||||
virtual void process(float delta) {}
|
|
||||||
virtual void physicsProcess(float delta) {}
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -70,8 +70,6 @@ int main() {
|
||||||
|
|
||||||
logger(Information, "Started Hibis test app! BEHOLD: Colours.");
|
logger(Information, "Started Hibis test app! BEHOLD: Colours.");
|
||||||
while (renderer.mKeepOpen) {
|
while (renderer.mKeepOpen) {
|
||||||
engine.runNodeProcesses();
|
|
||||||
|
|
||||||
// Colour changing background!
|
// Colour changing background!
|
||||||
if ((red == 255 && increaseRed) || (red == 0 && !increaseRed)) {
|
if ((red == 255 && increaseRed) || (red == 0 && !increaseRed)) {
|
||||||
increaseRed = !increaseRed;
|
increaseRed = !increaseRed;
|
||||||
|
|
Loading…
Reference in a new issue