Skip to content

Quick Start Guide

ural89 edited this page Nov 8, 2025 · 1 revision

ConsoleCraftEngine – Quick Start Guide

Installing

Clone the repository and enter the engine folder:

git clone https://github.com/ural89/ConsoleCraftEngine
cd ConsoleCraftEngine

Create Your First Project

Run the project creation script:

./create_new_project.sh

When prompted, enter your project name. Project names must not contain spaces.

Build and run your project:

cd YourProject/build`
`./build.sh

You will see an example scene with an example game object. Use W A S D keys to move the object around.


Adding a Component to Your GameObject

Let’s add a ParticleSource component to the example game object.

1. Modify ExampleGameObject.h

Add a ParticleSource pointer in the private section:

class ExampleGameObject : public GameObject {
public:
    void Init() override;
    void OnInput(int input);
    void Update(float deltaTime) override;
private:
    class ParticleSource *particleSource;
};

2. Modify ExampleGameObject.cpp

Include the particle source header after #include "Input.h":

#include "ExampleGameObject.h"
#include "Input.h"
#include "Core/ParticleSystem/ParticleSource.h"

Create and add ParticleSource component to example gameobject

void ExampleGameObject::Init() {
    symbol = '8';
    sprite = {
        {1, 1},
        {1, 1},
    };
    auto inputEvent = BIND_EVENT_FN(ExampleGameObject::OnInput);
    Input::AddListener(inputEvent);

	//add particle source here
    particleSource = AddComponent<ParticleSource>();
}

Then update the OnInput method to emit particles when pressing Space:

void ExampleGameObject::OnInput(int input) {
    if (input == SPACEBAR) {
		int particleCount = 4;
        particleSource->EmitParticle(particleCount,
         FIRETYPEPARTICLE);
    }

    // existing input handling...
    if (std::tolower(input) == 'd') transform.MovePosition(1, 0);
    if (std::tolower(input) == 'a') transform.MovePosition(-1, 0);
    if (std::tolower(input) == 'w') transform.MovePosition(0, -1);
    if (std::tolower(input) == 's') transform.MovePosition(0, 1);
}

3. Rebuild & Run

Go back to the build folder and run your project again:

cd YourProject/build
./build.sh

Now, when you press Spacebar, particles will spawn around your game object!

Clone this wiki locally