1
\$\begingroup\$

I have an custom Game Engine, made in C++ and made in Microsoft Visual Studio 2019. Currently, this Game Engine has a .sln with the following projects:

  • TheGameEditor, which is the current entry point of the project (.exe). Inside it has a loop that has an App that handles all aspects of the Engine. Has dependencies with external libraries: glew32.lib OpenGL32.lib SDL2.lib SDL2main.lib imgui.lib implot.lib and also has dependencies with the other 2 static libraries created by TheOneAudio and TheOneEngine.

  • TheGameEngine, which is the project that handles the GameObjects and all the 3D stuff that a Game Engine does. Has dependencies with external libraries: OpenGL32.lib GlU32.lib assimp-vc142-mt.lib DevIL.lib and also has dependency with TheOneAudio. This project creates an static library .lib.

  • TheOneAudio, which is the project that handles the Audio aspects. Has dependencies with external libraries: CommunicationCentral.lib AkSoundEngine.lib AkMemoryMgr.lib AkStreamMgr.lib AkMusicEngine.lib AkSpatialAudio.lib AkAudioInputSource.lib ws2_32.lib In fact, has dependency with Wwise. This project creates an static library .lib.

I want to create a new entry point for the engine, so that when compiling the project it creates the .exe that starts the scene.

Do I have to recreate the App class loop just like in the TheGameEditor? And just add to this newly created project dependencies to the static libraries created from TheOneAudio and TheOneEngine?

This is the App class in TheGameEditor:

#ifndef __APP_H__
#define __APP_H__
#pragma once

#include "Log.h"
#include "Timer.h"
#include "..\TheOneEngine\EngineCore.h"
#include <iostream>
#include <sstream>
#include <vector>
#include <chrono>
#include <thread>
#include <string>
#include <list>


// Forward declaration
class Module;
class Window;
class Input;
class Hardware;
class SceneManager;
class Gui;
class Renderer3D;

enum class GameState {
    NONE,
    PLAY,
    PAUSE,
    PLAY_ONCE
};

class App
{
public:

    App(int argc, char* args[]);
    virtual ~App();

    bool Awake();   // Called before render is available
    bool Start();   // Called before the first frame
    bool Update();  // Called each loop iteration
    bool CleanUp(); // Called before quitting

    // Add a new module to handle
    void AddModule(Module* module, bool activate);

    // Exposing some properties for reading
    int GetArgc() const;
    const char* GetArgv(int index) const;

    std::vector<LogInfo> GetLogs();
    void AddLog(LogType type, const char* entry);
    void CleanLogs();

    int GetFrameRate() const;
    void SetFrameRate(int refreshRate);

    double GetDT() const;
    void SetDT(double dt);

    GameState state;
    void Play();
    void Pause();
    void PlayOnce();
    bool IsPlaying();
    bool IsInGameState();
    void Stop();

private:
    
    // Call order for each loop iteration
    void PrepareUpdate();
    bool PreUpdate();
    bool DoUpdate();
    bool PostUpdate();
    void FinishUpdate();

    Timer* game_timer;
    Timer* start_timer;

    float time_since_start;
    float game_time;
    float scale_time;
public:

    EngineCore* engine = nullptr;

    // Modules
    Window* window = nullptr;
    Input* input = nullptr;
    Hardware* hardware = nullptr;
    SceneManager* sceneManager = nullptr;
    Gui* gui = nullptr;
    Renderer3D* renderer3D = nullptr;

private:

    int argc;
    char** args;
    std::string title;
    std::string organization;

    std::list<Module*> modules;

    // Logs
    LogInfo logInfo;
    std::vector<LogInfo> logs;

    // Fps control
    std::chrono::duration<double> targetFrameDuration;
    std::chrono::steady_clock::time_point frameStart, frameEnd;

    int frameRate = 240;
    double dt = 0;
    double dtCount = 0;
    int frameCount = 0;
    int fps = 0;
};

extern App* app;

#endif  // !__APP_H__
\$\endgroup\$

0

You must log in to answer this question.

Browse other questions tagged .