Skip to content

Project Structuring

Sam edited this page Apr 29, 2022 · 3 revisions

Creating a new project

This should be easy enough, you use the EmptyProject project within the nova2d Visual Studio (2019+) solution. On each release, this should be a cleared project for you. During development though, this project may contain files/folders from How-to Videos.

The Game Structure

You project should be structured like this example, although it is not required.

  • res
  • src
    • main.cpp
    • scenes
      • MyScene.h
      • MyScene.cpp
    • other-source-files-and-their-folders

In the main.cpp file you need, at least this much setup code for an empty/working project:

#include "core/Game.h"
#include "scenes/MyScene.h"

int main(int argc, char* argv[])
{
    using namespace core;

    // Game Config
    Game game("Empty Project");

    // Need at least one scene added and configured as first scene
    MyScene* scene = new MyScene("myScene");
    n2dGameAddScene(scene);
    n2dGameConfigFirstScene(scene);
	
    game.Start(); // Starts engine's loop

    return Game::s_ExitCode;
}
Clone this wiki locally