restructure project for dynamic linking

This commit is contained in:
2025-02-26 12:12:31 -06:00
parent ca683b50e7
commit 1922896a1a
40 changed files with 11 additions and 0 deletions

View File

@@ -1,47 +0,0 @@
#include "application.h"
App* App::instance = nullptr;
App::App() {
if(instance != nullptr) {
std::cout << "App already exists\nThere can only be one!\n";
std::abort();
}
std::cout << "Initializing...\n";
instance = this;
window.init("test", 640, 640);
renderer.init();
}
App::~App() {
lStack.shutdown();
renderer.shutdown();
window.shutdown();
std::cout << "\nExiting...";
}
void App::run() {
std::cout << "\nTesting...\n";
lStack.pushLayer(new BaseLayer());
lStack.pushOverlay(new Overlay());
// Main loop
while (!done) {
lStack.propagateEvent(window.pollEvents());
renderer.draw();
}
}

View File

@@ -1,49 +0,0 @@
#pragma once
#include "engine.h"
#include "sdl2Window.h"
#include "vulkanRenderer.h"
#include "event.h"
#include "eventHandler.h"
#include "layer.h"
#include "layerstack.h"
#include "baseLayer.h"
#include "overlay.h"
class App {
public:
App();
~App();
void run();
inline Window& getWindow() { return window; }
inline Renderer& getRenderer() { return renderer; }
inline LayerStack& getLayerStack() { return lStack; }
inline static App& Get() { return *instance; }
bool done = false;
bool show = true;
private:
static App* instance;
Window window;
Renderer renderer;
LayerStack lStack;
};

View File

@@ -1,9 +0,0 @@
#include "application.h"
int main() {
App app;
app.run();
}

View File

@@ -1,58 +0,0 @@
#pragma once
//macros
#ifdef SHDR_PATH
#define STRINGIZE(x) #x
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
#endif
#include <iostream>
#include <stdio.h> // printf, fprintf
#include <stdlib.h> // abort
#include <vector>
#include <optional>
#include <set>
#include <cstdint> // Necessary for uint32_t
#include <limits> // Necessary for std::numeric_limits
#include <algorithm> // Necessary for std::clamp
#include <fstream>
#include <array>
#include <chrono>
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <vulkan/vulkan.h>
#include <SDL.h>
#include <SDL_video.h>
#include <SDL_vulkan.h>
#include "imgui.h"
#include "imconfig.h"
#include "imgui_internal.h"
#include "imgui_impl_sdl2.h"
#include "imgui_impl_vulkan.h"
//Forward declarations
class App;
class MouseButtonEvent;
class MouseMovedEvent;
class MouseScrolledEvent;
class KeyEvent;
class KeyTypedEvent;
class WindowEvent;
class Layer;

9
src/main.cpp Normal file
View File

@@ -0,0 +1,9 @@
#include "pch.hpp"
int main(int argc, char* argv[]) {
for(int i = 0; i < argc; i++) {
std::cout << argv[i] << std::endl;
}
}

1
src/pch.hpp Normal file
View File

@@ -0,0 +1 @@
#include <iostream>