Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6d603f3
Lua API: UI and SoundsService
CDevv Mar 18, 2026
dc10850
PlaySound function for Sounds
CDevv Mar 18, 2026
50ec6a5
Lua API exceptions, StateService API and Vector2 type, Sounds exporting
CDevv Mar 19, 2026
285f46a
Start of WorldService, basic Room type, Player type
CDevv Mar 20, 2026
640abb6
Actor usertype and Direction enum in Lua
CDevv Mar 21, 2026
f7c0c42
Added support for nil, bool, number, string, table and function types
sudoker0 Mar 21, 2026
ec200a4
Fix bug with editor crashing when saving room
sudoker0 Mar 21, 2026
80919ea
Allow overlay on hovering tiles to show up above all other tiles
sudoker0 Mar 21, 2026
3fd02bb
Force overriding the compiled binary
sudoker0 Mar 21, 2026
6d00258
add shared container vector holding baseContainer.
Thefirey33 Mar 21, 2026
a260db2
Merge branch 'lua-api' of https://github.com/rpgppengine/rpgpp into l…
sudoker0 Mar 21, 2026
34aae6e
Implement hotkey services
sudoker0 Mar 21, 2026
328df6a
bind "New Project" in menu bar
sudoker0 Mar 22, 2026
afe7216
Small change to HKS
sudoker0 Mar 22, 2026
c2b5500
Let interactable properties be owned by a unique_ptr + Introduce Prop…
CDevv Mar 22, 2026
6dd72fe
Merge branch 'lua-api' of https://github.com/CDevv/rpgpp into lua-api
CDevv Mar 22, 2026
a2e8983
Properly set onTouch + export the image's extension
CDevv Mar 22, 2026
0afe1b0
Added badge for buidling of rpg++
sudoker0 Mar 22, 2026
04b6513
Merge branch 'lua-api' of https://github.com/rpgppengine/rpgpp into l…
sudoker0 Mar 22, 2026
decebe3
Allow for regeneration of config when missing. Hotkeys stored in a
sudoker0 Mar 22, 2026
8e1afb4
Use a map for Actors in Room + Actor layer
CDevv Mar 22, 2026
8e32888
Merge branch 'lua-api' of https://github.com/CDevv/rpgpp into lua-api
CDevv Mar 22, 2026
c943fff
Look for playerActor
CDevv Mar 22, 2026
202c8dc
Improve hotkey service, allow for modifying of hotkeys!
sudoker0 Mar 22, 2026
02c375e
Bind hotkeys for RoomFileView
sudoker0 Mar 23, 2026
2900802
Merge pull request #38 from rpgppengine/main
sudoker0 Mar 23, 2026
6619511
Turns out designated initializers are C++20 features.
sudoker0 Mar 23, 2026
773f70a
Fix problems on MacOS
sudoker0 Mar 23, 2026
70f655d
Added bind for toggling brush mode
sudoker0 Mar 23, 2026
cdb9d84
Also check whether file view is in focus
sudoker0 Mar 23, 2026
206d7f8
Code linting
sudoker0 Mar 23, 2026
c81672d
Recently opened project support!
sudoker0 Mar 23, 2026
391f7fe
Bind translation, added translation
sudoker0 Mar 23, 2026
0b9f62a
Add bindings for Containers, TileMap, Prop, Interactable
CDevv Mar 23, 2026
e11132b
Translate new keys in bulgarian
CDevv Mar 23, 2026
3e5b886
update turkish translation
Thefirey33 Mar 23, 2026
7d33293
fix compiler warning
Thefirey33 Mar 23, 2026
5126fc0
fix segfault
Thefirey33 Mar 23, 2026
89d496f
remove not needed dependencies and finish up
Thefirey33 Mar 23, 2026
df521be
Remove incorrect statement about no Lua binding
sudoker0 Mar 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
![logo](docs/logo.png)
---
[![Build RPG++](https://github.com/rpgppengine/rpgpp/actions/workflows/build.yml/badge.svg)](https://github.com/rpgppengine/rpgpp/actions/workflows/build.yml)

RPG++ is an experimental 2D RPG game engine written in C++. It is currently in early development, but contributions are welcome!

***This is a fresh restart, there are currently no RPG++ lua bindings, the engine hasn't been implemented in this branch yet.***

<img src="docs/readme_img1.png" alt="screenshot of engine" width="640">

Requirements
Expand Down
11 changes: 10 additions & 1 deletion include/actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class Actor : public ISaveable {
std::array<std::vector<Vector2>, 8> animations;
/** A Direction enum, showing the current animation that is being played. */
Direction currentAnimation;
Direction lastAnimation;
bool tempAnimIsPlayed = false;

public:
/** Empty constructor. */
Expand All @@ -64,7 +66,7 @@ class Actor : public ISaveable {
Actor(std::unique_ptr<TileSet> tileSet, Vector2 atlasPos,
std::string tileSetSource);
/** Constructor that takes an ActorBin binary structure */
Actor(ActorBin bin);
Actor(const ActorBin &bin);
/** Dump this Actor's data to a nlohmann::json object. */
json dumpJson() override;
/** Unload routine. The UnloadTexture function will called here. */
Expand Down Expand Up @@ -125,6 +127,10 @@ class Actor : public ISaveable {
/** Add multiple frames to the chosen animation. */
void addAnimationFrames(Direction id,
const std::vector<std::vector<int>> &frames);
/** Temporarily play an animation */
void playAnimation(Direction id);
/** Check whether a temporary animation is playing */
bool isTempAnimationPlaying();
/** Change the Actor's current animation and play it. */
void changeAnimation(Direction id);
/** Get the path of the used TileSet. */
Expand All @@ -139,4 +145,7 @@ class Actor : public ISaveable {
void setCollisionRect(Rectangle rect);
};

Vector2 calcActorTilePos(Vector2 newPosition, Vector2 worldTileSize,
TileSet *tileSet);

#endif
26 changes: 26 additions & 0 deletions include/actorContainer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef _RPGPP_ACTORCONTAINER_H
#define _RPGPP_ACTORCONTAINER_H

#include "actor.hpp"

class ActorContainer {
private:
std::map<std::string, std::unique_ptr<Actor>> actors;

public:
/** Construct the actor container. */
ActorContainer();
/** Get the map itself */
std::map<std::string, std::unique_ptr<Actor>> &getActors();
/** Get an Actor with the specified name */
Actor &getActor(const std::string &name);
/** Add a new Actor with a name from the GameBin and an in-room name*/
void addActor(Vector2 pos, const std::string &typeName,
const std::string &roomName);
/** Remove an Actor */
void removeActor(const std::string &roomName);
/** Check whether an Actor with such an in-room name exists. */
bool actorExists(const std::string &roomName);
};

#endif // !_RPGPP_ACTORCONTAINER_H
51 changes: 51 additions & 0 deletions include/baseContainer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef _RPGPP_BASECONTAINER_H
#define _RPGPP_BASECONTAINER_H

#include "conversion.hpp"
#include "gamedata.hpp"
#include "raylib.h"
#include <map>
#include <stdexcept>

template <typename T> class BaseContainer {

protected:
/** The list of objects kept inside of this container. */
std::map<IVector, T> objects = {};

public:
BaseContainer<T>() {}

/** Pushes an object to the map. */
void pushObject(IVector pos, T obj) {
this->objects.try_emplace(pos, std::move(obj));
}
void pushObjectVec2(Vector2 pos, T obj) {
pushObject(fromVector2(pos), obj);
}
/** Remove an object existing at a position. */
void removeObject(IVector pos) {
auto key = this->objects.find(pos);
if (key != this->objects.end()) {
this->objects.erase(key);
}
}
void removeObjectVec2(Vector2 pos) { removeObject(fromVector2(pos)); }
/** Check if an object exists at specified position. */
bool objectExistsAtPosition(IVector pos) {
return this->objects.find(pos) != this->objects.end();
}
bool objectExistsAtPositionVec2(Vector2 pos) {
return objectExistsAtPosition(fromVector2(pos));
}
/** Gets the object at a specified IVector Position. */
T &getObjectAtPosition(IVector pos) {
if (this->objects.find(pos) != this->objects.end())
return this->objects[pos];
throw std::out_of_range("key not found!");
}
/** Get a reference to the whole object map. */
std::map<IVector, T> &getObjects() { return this->objects; }
};

#endif // !_RPGPP_BASECONTAINER_H
18 changes: 5 additions & 13 deletions include/collisionsContainer.hpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
#ifndef _RPGPP_COLLISIONSCONTAINER_H
#define _RPGPP_COLLISIONSCONTAINER_H

#include "baseContainer.hpp"
#include "gamedata.hpp"
#include <raylib.h>
#include <vector>

/** A container of collision tiles to be used by a Room */
class CollisionsContainer {
private:
/** A vector that contains the tile positions of the collision tiles */
std::vector<Vector2> vec;

class CollisionsContainer : public BaseContainer<bool> {
public:
/** Empty constructor */
CollisionsContainer();
/** Add a collision tile to this container */
void addCollisionTile(int x, int y);
/** Remove a collision tile by its tile position */
void removeCollisionTile(int x, int y);
/** Get a reference to this container's vector. Items are tile positions of
* the collision tiles. */
const std::vector<Vector2> &getVector() const;
/** Add a collision */
void pushCollision(IVector pos);
};

#endif
3 changes: 2 additions & 1 deletion include/constants/room.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ enum class RoomLayer {
LAYER_TILES,
LAYER_COLLISION,
LAYER_INTERACTABLES,
LAYER_PROPS
LAYER_PROPS,
LAYER_ACTORS
};
enum class RoomTool {
TOOL_NONE,
Expand Down
9 changes: 9 additions & 0 deletions include/conversion.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef _RPGPP_CONVERSION_H
#define _RPGPP_CONVERSION_H

#include "gamedata.hpp"
#include "raylib.h"
Vector2 fromIVector(const IVector &other);
IVector fromVector2(const Vector2 &other);

#endif // !_RPGPP_CONVERSION_H
5 changes: 3 additions & 2 deletions include/editor/actions/mapAction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ struct MapActionData {
RoomView *view;
Room *room;
RoomLayer layer;
std::string interactable;
std::string interactableFullPath;
Vector2 worldTile;
Vector2 tile;
Vector2 prevTile;
std::string interactable;
std::string interactableFullPath;
std::string actorName;
};

class MapAction : public Action {
Expand Down
38 changes: 38 additions & 0 deletions include/editor/defaultConfig.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "editor.hpp"
#include "raylib.h"
#include "services/hotkeyService.hpp"
#include <map>
#include <string>
#include <utility>
#include <vector>

// key-value
using ConfigEntry = std::map<std::string, std::string>;
// [field]
using Config = std::map<std::string, ConfigEntry>;

const std::string h(Hotkey hk) {
return std::to_string(HotkeyService::pack(hk));
}

const Config BASE_CONFIG = {
{"rpgpp",
{
{"language", "en_us"},
{"theme", "Dark"},
}},
{"hotkeys",
{{"close_tab", h(Hotkey{}.withCtrl().withKey(KEY_W))},
{"new_project", h(Hotkey{}.withCtrl().withKey(KEY_N))},
{"open_project", h(Hotkey{}.withCtrl().withKey(KEY_O))},
{"redo", h(Hotkey{}.withCtrl().withKey(KEY_Y))},
{"save_file", h(Hotkey{}.withCtrl().withKey(KEY_S))},
{"toggle_debug", h(Hotkey{}.withKey(KEY_F3))},
{"undo", h(Hotkey{}.withCtrl().withKey(KEY_Z))},
{"room_tool.mouse", h(Hotkey{}.withKey(KEY_ONE))},
{"room_tool.pen", h(Hotkey{}.withKey(KEY_TWO))},
{"room_tool.eraser", h(Hotkey{}.withKey(KEY_THREE))},
{"room_tool.edit", h(Hotkey{}.withKey(KEY_FOUR))},
{"room_tool.set_spoint", h(Hotkey{}.withKey(KEY_FIVE))},
{"room_tool.toggle_bm", h(Hotkey{}.withKey(KEY_SIX))}}},
};
6 changes: 6 additions & 0 deletions include/editor/editor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "raylib.h"
#include "services/editorGuiService.hpp"
#include "services/fileSystemService.hpp"
#include "services/hotkeyService.hpp"
#include "services/recentProjectService.hpp"
#include "services/themeService.hpp"
#include "services/translationService.hpp"
#include <memory>
Expand All @@ -29,6 +31,8 @@ class Editor {
// the current editor gui service, responsible for managing the gui.
ThemeService themeService;
EditorGuiService guiService;
HotkeyService hotkeyService;
RecentProjectService recentProjectService;

public:
Editor();
Expand All @@ -43,7 +47,9 @@ class Editor {
TranslationService &getTranslations();
ThemeService &getThemeService();
FileSystemService &getFs();
RecentProjectService &getRecentProjectService();
ConfigurationService &getConfiguration();
HotkeyService &getHotkeyService();
Project *getProject() const;
void setProject(const std::string &path);
// this sets the icon of the editor.
Expand Down
2 changes: 2 additions & 0 deletions include/editor/fileViews/fileView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class FileView {
std::stack<std::unique_ptr<Action>> future;

public:
bool fileViewFocused = false;

FileView();
virtual ~FileView();

Expand Down
6 changes: 6 additions & 0 deletions include/editor/fileViews/roomFileView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#include "roomViewModesHandler.hpp"
#include "views/roomView.hpp"
#include "views/tileSetView.hpp"
#include "views/worldView.hpp"
#include "widgets/propertyFields/fileField.hpp"
#include "widgets/propertyFields/intField.hpp"
#include "widgets/toolbox.hpp"
#include <TGUI/Widgets/ComboBox.hpp>
#include <memory>

Expand All @@ -28,9 +30,13 @@ class RoomFileView : public FileView {
FileField::Ptr tileSetField;
FileField::Ptr musicFileField;

void setRoomTool(ToolboxItem<RoomTool> tool);
std::vector<std::string> hotkeyEntries;

public:
std::unique_ptr<RoomViewModesHandler> modesHandler;
RoomFileView();
~RoomFileView();
void init(tgui::Group::Ptr layout, VariantWrapper *variant) override;
};

Expand Down
5 changes: 3 additions & 2 deletions include/editor/project.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class Project {

public:
Project(const std::string &path);
static void create(const std::string &dirPath, const std::string &title);
static std::string create(const std::string &dirPath, const std::string &title);
static void openProject(const tgui::String &filePath, bool forceSwitch = false);
json toJson();
std::string &getTitle();
std::string &getBasePath();
Expand All @@ -32,4 +33,4 @@ class Project {
void buildProject();
};

#endif
#endif
15 changes: 12 additions & 3 deletions include/editor/roomLayerViewVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,42 @@
#define _RPGPP_ROOMLAYERVIEWVISITOR_H

#include "TGUI/Widgets/ComboBox.hpp"
#include "TGUI/Widgets/EditBox.hpp"
#include "TGUI/Widgets/Group.hpp"
#include "actor.hpp"
#include "interactable.hpp"
#include "prop.hpp"
#include "views/tileSetView.hpp"
#include "views/worldView.hpp"
#include <enum_visitor/enum_visitor.hpp>
#include <memory>
#include <raylib.h>

class RoomLayerViewVisitor
: public mj::enum_visitor<
RoomLayer, RoomLayer::LAYER_TILES, RoomLayer::LAYER_COLLISION,
RoomLayer::LAYER_INTERACTABLES, RoomLayer::LAYER_PROPS> {
: public mj::enum_visitor<RoomLayer, RoomLayer::LAYER_TILES,
RoomLayer::LAYER_COLLISION,
RoomLayer::LAYER_INTERACTABLES,
RoomLayer::LAYER_PROPS, RoomLayer::LAYER_ACTORS> {
public:
RoomLayerViewVisitor();
tgui::Group::Ptr group{nullptr};
RoomTool tool;
Interactable *inter{nullptr};
Prop *prop{nullptr};
Texture2D propTexture{};
Texture2D actorTexture{};
std::unique_ptr<Actor> chosenActor;
void operator()(enum_v<RoomLayer::LAYER_COLLISION>);
void operator()(enum_v<RoomLayer::LAYER_TILES>);
void operator()(enum_v<RoomLayer::LAYER_INTERACTABLES>);
void operator()(enum_v<RoomLayer::LAYER_PROPS>);
void operator()(enum_v<RoomLayer::LAYER_ACTORS>);

TileSetView::Ptr tileSetView;
tgui::ComboBox::Ptr interactableChoose;
tgui::ComboBox::Ptr propChoose;
tgui::ComboBox::Ptr actorChoose;
tgui::EditBox::Ptr actorNameInput;

~RoomLayerViewVisitor();
};
Expand Down
2 changes: 1 addition & 1 deletion include/editor/screens/guiScreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UIScreen {
// to create widgets.
}

virtual void bindMenuBar(tgui::MenuBar::Ptr menubar) {}
virtual void bindMenuBarAndHK(tgui::MenuBar::Ptr menubar) {}
virtual void mouseMove(int x, int y) {}
virtual void leftMouseReleased(int x, int y) {}
virtual void unloadScreen() {
Expand Down
4 changes: 3 additions & 1 deletion include/editor/screens/projectScreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class ProjectScreen : public UIScreen {
tgui::ContextMenu::Ptr fileContextMenu;
tgui::Label::Ptr projectLabel;

tgui::String focusedFile;

private:
void switchView(tgui::String id);
void clearView();
Expand All @@ -58,7 +60,7 @@ class ProjectScreen : public UIScreen {
void addResourceButtons(EngineFileType fileType);
void mouseMove(int x, int y) override;
void leftMouseReleased(int x, int y) override;
void bindMenuBar(tgui::MenuBar::Ptr menubar) override;
void bindMenuBarAndHK(tgui::MenuBar::Ptr menubar) override;
void layoutReload();
ProjectFile &getCurrentFile();
void initItems(tgui::Group::Ptr layout) override;
Expand Down
Loading
Loading