diff --git a/.github/workflows/build-doc.yml b/.github/workflows/build-doc.yml
index 53457df1..afa6b4f4 100644
--- a/.github/workflows/build-doc.yml
+++ b/.github/workflows/build-doc.yml
@@ -2,9 +2,9 @@ name: "Build documentations"
on:
push:
- branches: ["main", "docs"]
+ branches: ["main"]
pull_request:
- branches: ["main", "docs"]
+ branches: ["main"]
workflow_dispatch:
env:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2f7ddfea..88b2214a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -26,10 +26,14 @@ jobs:
fetch-depth: 0
submodules: recursive
+ - name: Install xmake
+ uses: xmake-io/github-action-setup-xmake@v1
+ with:
+ xmake-version: latest
+
- name: Install packages
shell: bash
run: |
- sudo add-apt-repository ppa:xmake-io/xmake
sudo apt-get update
sudo apt-get install -y \
libx11-dev \
@@ -38,8 +42,7 @@ jobs:
libxcursor-dev \
libxi-dev \
libgl1-mesa-dev \
- mesa-common-dev \
- xmake
+ mesa-common-dev
- name: Build
shell: bash
@@ -70,6 +73,10 @@ jobs:
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
+ - name: Configure
+ run: |
+ xmake global --clean
+ xmake config --plat=windows --arch=x64 -y
- name: Build
shell: pwsh
diff --git a/docs/guide.rst b/docs/guide.rst
index 66a0ba2a..1d9bb619 100644
--- a/docs/guide.rst
+++ b/docs/guide.rst
@@ -10,4 +10,5 @@ Learn how to install and use RPG++ to make a simple RPG game!
guide/mainconcepts
guide/editorlayout
guide/editoroptions
+ guide/projectsettings
guide/typesindex
\ No newline at end of file
diff --git a/docs/guide/editorlayout.rst b/docs/guide/editorlayout.rst
index 5273e271..390fb56a 100644
--- a/docs/guide/editorlayout.rst
+++ b/docs/guide/editorlayout.rst
@@ -45,6 +45,11 @@ Here you can see the title of the opened project, as well as a Playtest button a
* **Build** - Export the project. This will result in a .bin file and an executable file in the project's root directory.
+ .. image:: ../images/rpgpp-projectsettingsbutton.png
+ :width: 40%
+
+ * **Project Settings** - Open the Project Settings window, where you can change settings about your project.
+
* `(3)` - **Resources List**
Here you can see the resources of the project. The dropdown lets you choose which type of resource do you want to be listed. You can click on any file listed here. The "New Resource" button creates a new resource of the type that is currently chosen in the dropdown.
diff --git a/docs/guide/projectsettings.rst b/docs/guide/projectsettings.rst
new file mode 100644
index 00000000..99a128fc
--- /dev/null
+++ b/docs/guide/projectsettings.rst
@@ -0,0 +1,45 @@
+Project Settings
+================
+
+In this window you can change or view settings that will impact the game's window or the gameplay.
+
+.. image:: ../images/rpgpp-projectsettings.png
+ :width: 40%
+
+There are two categories in Project Settings:
+
+* **Program**:
+
+ This category changes how the program's window behaves.
+
+ * **Title** - The Window's title.
+
+ * **Program Icon** - The icon of the window.
+
+ * **Version** - Version of the game.
+
+ * **Window Width** - Width of the window.
+
+ * **Window Height** - Height of the window.
+
+ * **Is Window Resizeable** - Whether the window will be resizeable.
+
+ * **Window Mode** - windowed, exclusive, minimized, maximized, fullscreen.
+
+ * **Target FPS** - The frames per second that will be targeted.
+
+* **Game**:
+
+ This category changes the gameplay of the game.
+
+ * **Default Room** - The room in which the player will first spawn.
+
+ * **Player Actor** - The Actor file which will be used for the Player's appearance.
+
+ * **Tile Size** - The tile size in maps.
+
+ * **Debug Draw** - Drawing objects like collision boxes and etc.
+
+ * **Export Image Scales** - What image scales to be exported.
+
+ * **Export Font Sizes** - What font sizes the fonts shall be exported in.
\ No newline at end of file
diff --git a/docs/guide/resourcetypes/dialogue.rst b/docs/guide/resourcetypes/dialogue.rst
index 062b4e12..91443943 100644
--- a/docs/guide/resourcetypes/dialogue.rst
+++ b/docs/guide/resourcetypes/dialogue.rst
@@ -12,25 +12,32 @@ Example of a Dialogue file (.rdiag):
.. code:: json
{
- "diag": [
- [
- "Xenith",
- "I changed the dialogue!",
- "0",
- ""
- ],
- [
- "Xenith",
- "This is the second line!",
- "0",
- ""
- ],
- [
- "Xenith",
- "Content",
- "0",
- ""
- ]
+ "diag":[
+ {
+ "characterName":"Chara",
+ "hasOptions":false,
+ "hasPortrait":false,
+ "imageId":"",
+ "options":[],
+ "text":"My dialogue text!"
+ },
+ {
+ "characterName":"Character",
+ "hasOptions":true,
+ "hasPortrait":true,
+ "imageId":"xenith-portrait.png",
+ "options":[
+ {
+ "name":"Option 1",
+ "nextDialogue":"mydiag.rdiag"
+ },
+ {
+ "name":"Option 2",
+ "nextDialogue":"diag.rdiag"
+ }
+ ],
+ "text":"Spooky RED text!"
+ }
]
}
@@ -55,7 +62,23 @@ The "Add a new line" button will add a new line to this Dialogue.
The "Has a portrait?" option sets whether this line will have a portrait image shown for it. If it is on, then you can select an image to be shown.
-You can also edit the Character name and the text content for the dialogue line.
+You can also edit the Character name and the text content for the dialogue line. Dialogue text supports XML-like tags for formatting the text or achieving other effects. All tags must have a closing tag.
+
+* **Color tags:** - , , , , , , , , , , , , , , , , , , , , , , ,
+
+* **** - Adds a delay in the typewriter effect in the dialogue UI.
+
+* **** - Changes the size of the text. It has one property *size* which is to be set to a number. Example usage: ``my text!``
+
+* **** - Changes the font of the written text. Example: ``My text!``
+
+* **** - Gives the written text a padding. It can be either in pixels of percentage of the dialogue box.
+ * Example for pixels: ``Padded text in pixels``
+ * Example for percentage: ``Padded text in percentage``
+
+* **** - Plays a different sound while typing out this text. Example: ``Baa!``
+
+* **** - Positions the text on a new line. Example: ``text``
The 'X' button deletes this line.
diff --git a/docs/guide/resourcetypes/interactable.rst b/docs/guide/resourcetypes/interactable.rst
new file mode 100644
index 00000000..7acd587d
--- /dev/null
+++ b/docs/guide/resourcetypes/interactable.rst
@@ -0,0 +1,44 @@
+Interactable
+============
+
+=======================
+What is an Interactable
+=======================
+
+An Interactable is an object that the player can interact with. It has an attached script that defines its behaviour. It can placed on its own or exist within a Prop or an Actor.
+
+Example of an Interactable file:
+
+.. code:: json
+
+ {
+ "name":"myinter",
+ "onTouch":false,
+ "props":{
+ "newint":0,
+ "x":0
+ },
+ "script":"scripts/test.lua"
+ }
+
+====================================
+Creating and editing an Interactable
+====================================
+
+To create an Interactable, you just need to give it a name.
+
+.. image:: ../../images/rpgpp-createinteractable.png
+ :width: 40%
+
+Then you can edit its properties.
+
+.. image:: ../../images/rpgpp-interactableview.png
+ :width: 40%
+
+* **Display Name** - Sets a friendly name that will show up only in the editor.
+
+* **Script** - Sets a Lua script that will define the Interactable's behaviour. THe script must have an interact() function.
+
+* **On Touch?** - Whether this Interactable will trigger when the player collides with the interactable.
+
+On top of that, you can add or remove your own properties for the Interactable.
diff --git a/docs/guide/resourcetypes/prop.rst b/docs/guide/resourcetypes/prop.rst
index d52cb73d..5ead9e8d 100644
--- a/docs/guide/resourcetypes/prop.rst
+++ b/docs/guide/resourcetypes/prop.rst
@@ -52,3 +52,5 @@ You can also change the image for this Prop.
Atlas Rect refers to the portion of the Prop Image, that will be shown.
Collision Rect refers to the position and size of the collision, relative to the top left corner of the Prop.
Both properties have X and Y for position and W and H for size.
+
+You can also see a preview of your Prop under the properties. It will show how the Prop will actually look like in-game.
diff --git a/docs/guide/typesindex.rst b/docs/guide/typesindex.rst
index aa52e316..dc658089 100644
--- a/docs/guide/typesindex.rst
+++ b/docs/guide/typesindex.rst
@@ -6,4 +6,5 @@ Resource Types
resourcetypes/room
resourcetypes/actor
resourcetypes/dialogue
- resourcetypes/prop
\ No newline at end of file
+ resourcetypes/prop
+ resourcetypes/interactable
\ No newline at end of file
diff --git a/docs/images/rpgpp-createinteractable.png b/docs/images/rpgpp-createinteractable.png
new file mode 100644
index 00000000..ba9df1b7
Binary files /dev/null and b/docs/images/rpgpp-createinteractable.png differ
diff --git a/docs/images/rpgpp-editeddialogueline.png b/docs/images/rpgpp-editeddialogueline.png
index 7a9d50ff..04e67d6e 100644
Binary files a/docs/images/rpgpp-editeddialogueline.png and b/docs/images/rpgpp-editeddialogueline.png differ
diff --git a/docs/images/rpgpp-editorlayout.png b/docs/images/rpgpp-editorlayout.png
index 917953e3..177e1a13 100644
Binary files a/docs/images/rpgpp-editorlayout.png and b/docs/images/rpgpp-editorlayout.png differ
diff --git a/docs/images/rpgpp-interactableview.png b/docs/images/rpgpp-interactableview.png
new file mode 100644
index 00000000..7214da84
Binary files /dev/null and b/docs/images/rpgpp-interactableview.png differ
diff --git a/docs/images/rpgpp-newdialogueline.png b/docs/images/rpgpp-newdialogueline.png
index d25b0b05..34543545 100644
Binary files a/docs/images/rpgpp-newdialogueline.png and b/docs/images/rpgpp-newdialogueline.png differ
diff --git a/docs/images/rpgpp-projectmenu.png b/docs/images/rpgpp-projectmenu.png
index 66b8707b..0da14ec4 100644
Binary files a/docs/images/rpgpp-projectmenu.png and b/docs/images/rpgpp-projectmenu.png differ
diff --git a/docs/images/rpgpp-projectsettings.png b/docs/images/rpgpp-projectsettings.png
new file mode 100644
index 00000000..83d5f187
Binary files /dev/null and b/docs/images/rpgpp-projectsettings.png differ
diff --git a/docs/images/rpgpp-projectsettingsbutton.png b/docs/images/rpgpp-projectsettingsbutton.png
new file mode 100644
index 00000000..faaf97ab
Binary files /dev/null and b/docs/images/rpgpp-projectsettingsbutton.png differ
diff --git a/docs/images/rpgpp-propview.png b/docs/images/rpgpp-propview.png
index aa9c7717..3880b6c7 100644
Binary files a/docs/images/rpgpp-propview.png and b/docs/images/rpgpp-propview.png differ
diff --git a/include/actor.hpp b/include/actor.hpp
index d6c5d5b3..e3159521 100644
--- a/include/actor.hpp
+++ b/include/actor.hpp
@@ -1,37 +1,40 @@
#ifndef _RPGPP_ACTOR_H
#define _RPGPP_ACTOR_H
-#include "atlasTile.hpp"
-#include "gamedata.hpp"
-#include "saveable.hpp"
-#include "tileset.hpp"
+#include
+
#include
#include
#include
#include
-#include
#include
+#include "atlasTile.hpp"
+#include "gamedata.hpp"
+#include "interactable.hpp"
+#include "saveable.hpp"
+#include "tileset.hpp"
+
using json = nlohmann::json;
#define RPGPP_MAX_DIRECTION 7
/** Direction enum, representing an animation state. */
enum Direction : short {
- RPGPP_DOWN_IDLE = 0, ///< Down Idle state.
- RPGPP_DOWN = 1, ///< Down state.
- RPGPP_UP_IDLE = 2, ///< Up Idle state.
- RPGPP_UP = 3, ///< Up state.
- RPGPP_LEFT_IDLE = 4, ///< Left Idle state.
- RPGPP_LEFT = 5, ///< Left state.
- RPGPP_RIGHT_IDLE = 6, ///< Right Idle state.
- RPGPP_RIGHT = 7 ///< Right state.
+ RPGPP_DOWN_IDLE = 0, ///< Down Idle state.
+ RPGPP_DOWN = 1, ///< Down state.
+ RPGPP_UP_IDLE = 2, ///< Up Idle state.
+ RPGPP_UP = 3, ///< Up state.
+ RPGPP_LEFT_IDLE = 4, ///< Left Idle state.
+ RPGPP_LEFT = 5, ///< Left state.
+ RPGPP_RIGHT_IDLE = 6, ///< Right Idle state.
+ RPGPP_RIGHT = 7 ///< Right state.
};
/** The Actor class represents an Actor in the game's world.
* @see [Direction](Direction.md)
*/
class Actor : public ISaveable {
- private:
+private:
std::string sourcePath;
/** The used TileSet for this Actor's sprites. */
std::unique_ptr tileSet;
@@ -55,16 +58,19 @@ class Actor : public ISaveable {
Direction currentAnimation;
Direction lastAnimation;
bool tempAnimIsPlayed = false;
+ /** Whether this Actor has an Interactable. */
+ bool ownsInteractable = false;
+ /** A smart pointer, owning an Interactable. */
+ std::unique_ptr interactable;
- public:
+public:
/** Empty constructor. */
Actor() = default;
/** Constructor that takes a path to the .ractor file. */
Actor(const std::string &fileName);
/** Constructor that takes a TileSet, the atlas position of the tile to use,
* and the path to the TileSet. */
- Actor(std::unique_ptr tileSet, Vector2 atlasPos,
- std::string tileSetSource);
+ Actor(std::unique_ptr tileSet, Vector2 atlasPos, std::string tileSetSource);
/** Constructor that takes an ActorBin binary structure */
Actor(const ActorBin &bin);
/** Dump this Actor's data to a nlohmann::json object. */
@@ -114,6 +120,8 @@ class Actor : public ISaveable {
/** Get the collision rectangle of this Actor if it was moved by the
* velocity vector */
Rectangle getCollisionRect(Vector2 velocity) const;
+ /** Get the collision Rectangle of this Actor */
+ Rectangle getCollisionRect() const;
/** Get collision center point. */
Vector2 getCollisionCenter() const;
/** Add a frame in the chosen animation. The frame represents an atlas tile
@@ -125,8 +133,7 @@ class Actor : public ISaveable {
* TileSet. */
void setAnimationFrame(Direction id, int frameIndex, Vector2 atlasTile);
/** Add multiple frames to the chosen animation. */
- void addAnimationFrames(Direction id,
- const std::vector> &frames);
+ void addAnimationFrames(Direction id, const std::vector> &frames);
/** Temporarily play an animation */
void playAnimation(Direction id);
/** Check whether a temporary animation is playing */
@@ -139,13 +146,18 @@ class Actor : public ISaveable {
std::array, 8> getAnimationsRaw() const;
/** Get a specific animation */
std::vector getAnimationRaw(Direction id) const;
- /** Get the collision Rectangle of this Actor */
- Rectangle getCollisionRect() const;
/** Set the Actor's collision Rectangle */
void setCollisionRect(Rectangle rect);
+ /** Whether this Actor has an Interactable. */
+ bool hasInteractable();
+ /** Set the 'ownsInteractable' flag. */
+ void setHasInteractable(bool value);
+ /** Get a pointer to this Actor's Interactable. */
+ Interactable *getInteractable();
+ /** Add an Interactable using an interactable file. */
+ void setInteractableFromPath(const std::string &interPath);
};
-Vector2 calcActorTilePos(Vector2 newPosition, Vector2 worldTileSize,
- TileSet *tileSet);
+Vector2 calcActorTilePos(Vector2 newPosition, Vector2 worldTileSize, TileSet *tileSet);
#endif
diff --git a/include/actorContainer.hpp b/include/actorContainer.hpp
index e06bab28..38504b41 100644
--- a/include/actorContainer.hpp
+++ b/include/actorContainer.hpp
@@ -4,10 +4,10 @@
#include "actor.hpp"
class ActorContainer {
- private:
+private:
std::map> actors;
- public:
+public:
/** Construct the actor container. */
ActorContainer();
/** Get the map itself */
@@ -15,12 +15,11 @@ class ActorContainer {
/** 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);
+ 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
+#endif // !_RPGPP_ACTORCONTAINER_H
diff --git a/include/atlasTile.hpp b/include/atlasTile.hpp
index 6baaa43f..2afe57ad 100644
--- a/include/atlasTile.hpp
+++ b/include/atlasTile.hpp
@@ -7,13 +7,13 @@
* Represents a source atlas tile from a TileSet.
*/
class AtlasTile {
- private:
+private:
/** Pointer to the used Texture */
Texture *texture;
/** The atlas (source) coordinates from the TileSet. */
Vector2 atlasCoords;
- public:
+public:
/**
* Empty constructor
*/
diff --git a/include/baseContainer.hpp b/include/baseContainer.hpp
index 9d1345a1..d57da766 100644
--- a/include/baseContainer.hpp
+++ b/include/baseContainer.hpp
@@ -1,28 +1,25 @@
#ifndef _RPGPP_BASECONTAINER_H
#define _RPGPP_BASECONTAINER_H
-#include "conversion.hpp"
-#include "gamedata.hpp"
-#include "raylib.h"
#include