Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,5 @@ build/
CMakeFiles/
CMakeCache.txt
textures/
RaylibGuiCreator
RaylibGuiCreator
X64-Ubuntu-RaylibGuiCreator-BETA
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "build/extern/raylib"]
path = build/extern/raylib
url = https://github.com/raysan5/raylib.git
[submodule "extern/raylib"]
path = extern/raylib
url = https://github.com/raysan5/raylib.git
28 changes: 24 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
{
"name": "Raylib GUI Creator",
"version": "0.2.0",
"configurations": []
}
"version": "0.2",
"configurations": [
{
"name": "Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/RaylibGuiCreator",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build"
}
]
}
24 changes: 20 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "cmake",
"args": [
"--build",
"${workspaceFolder}/build",
"--config",
"Debug"
],
"group": "build",
"problemMatcher": [
"$gcc"
],
"detail": "Building the project..."
},
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
Expand All @@ -23,6 +40,5 @@
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
]
}
28 changes: 22 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,30 @@ project(RaylibGuiCreator)

set(CMAKE_CXX_STANDARD 20) # Use C++ 20

if (WIN32)
find_package(raylib CONFIG REQUIRED) # For VCPKG
else()
find_package(raylib REQUIRED) # For Linux/Unix
# Enable Release mode
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()


add_subdirectory(extern/raylib)
include_directories(extern/raylib/src)
include_directories(extern/raylib/src/external)

file(GLOB RAYLIB_SOURCES ${CMAKE_CURRENT_LIST_DIR}/*.cpp)

add_executable(RaylibGuiCreator ${RAYLIB_SOURCES})
target_include_directories(RaylibGuiCreator PRIVATE ${raylib_INCLUDE_DIRS})
target_link_libraries(RaylibGuiCreator PRIVATE ${raylib_LIBRARIES})
target_link_libraries(RaylibGuiCreator PRIVATE raylib)

project(RaylibGuiCreator)

# Apply Release mode specific settings
if(CMAKE_BUILD_TYPE STREQUAL "Release")
# Add optimization flags
target_compile_options(RaylibGuiCreator PRIVATE -O3)

# Optionally, strip symbols to reduce binary size
if (NOT WIN32)
target_link_options(RaylibGuiCreator PRIVATE -s)
endif()
endif()
11 changes: 1 addition & 10 deletions Functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,4 @@ bool NormalFunctions::stringIsInt(std::string string) {
}
}
return true;
}

size_t NormalFunctions::findMutipleChar(std::string string, char charToFind, int amount) { // use .find instead just here to not destroy anything or if I make a improved ver
size_t index = string.find_first_of(charToFind);
for (int i = 1; i < amount; i++) {
if (string.at(index + i) != charToFind)
return std::string::npos;
}
return index + static_cast<size_t>(amount);
}
}
1 change: 0 additions & 1 deletion Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@

namespace NormalFunctions {
bool stringIsInt(std::string string);
size_t findMutipleChar(std::string string, char charToFind, int amount);
}
140 changes: 140 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.27

# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target

# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Disable VCS-based implicit rules.
% : %,v

# Disable VCS-based implicit rules.
% : RCS/%

# Disable VCS-based implicit rules.
% : RCS/%,v

# Disable VCS-based implicit rules.
% : SCCS/s.%

# Disable VCS-based implicit rules.
% : s.%

.SUFFIXES: .hpux_make_needs_suffix_list

# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s

#Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake

# The command to remove a file.
RM = /usr/bin/cmake -E rm -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = "/media/sparkles/Games n stuff1/CODING/RaylibGuiCreator"

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = "/media/sparkles/Games n stuff1/CODING/RaylibGuiCreator"

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
@echo "Running external command ..."
/usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target rebuild_cache
rebuild_cache:
@echo "Running external command ..."
/usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start "/media/sparkles/Games n stuff1/CODING/RaylibGuiCreator/CMakeFiles" "/media/sparkles/Games n stuff1/CODING/RaylibGuiCreator//CMakeFiles/progress.marks"
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start "/media/sparkles/Games n stuff1/CODING/RaylibGuiCreator/CMakeFiles" 0
.PHONY : all

# The main clean target
clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast

# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
.PHONY : help



#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

32 changes: 27 additions & 5 deletions RaylibFunctions.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define MAX_KEYS 512

#include "RaylibFunctions.h"

#include "window.h"
Expand Down Expand Up @@ -215,6 +217,14 @@ Rectangle RaylibFunctionsClass::drawRightClickMenu(int textureNum, Vector2* Text
return menuRecOutline;
}

bool RaylibFunctionsClass::allKeysReleased() {
for (int i = 0; i < MAX_KEYS; i++) {
if (IsKeyDown(i))
return false;
}
return true;
}

Texture2D* DragSystem::getTextureByNum(int num) {
auto it = Drag.getTextureMap()->begin();
std::advance(it, num);
Expand Down Expand Up @@ -357,9 +367,11 @@ void FileSystem::exportToFile(Rectangle rec, std::string& filename) {
file.close();
}

void FileSystem::importFromFile(std::string& filename) { // move this/create a better loader in RaylibAdditions and include it here instead
bool FileSystem::importFromFile(std::string& filename) { // move this/create a better loader in RaylibAdditions and include it here instead
std::ifstream file;
file.open(filename + ".gui");
if (!file.is_open())
return false;
std::string line;
int i = 0;
int currentFrame = 0;
Expand All @@ -378,9 +390,16 @@ void FileSystem::importFromFile(std::string& filename) { // move this/create a b
MainRoom.size = size;
continue;
}
size_t index = NormalFunctions::findMutipleChar(line, '!', 3);
if (index != std::string::npos) {
std::string value = line.substr(index, line.length());
if (i == 3) {
if (line != "!!!buttons:")
continue;
std::cout << "Error: File is empty" << std::endl;
return false;
}
size_t index = line.find("!!!");
if (index != std::string::npos && index + 3 == 3) {
std::string value = line.substr(index + 3, line.length());
std::cout << value;
value = value.substr(0, value.find(':'));
if (NormalFunctions::stringIsInt(value)) {
currentFrame = std::stoi(value); // use later when frame system is in place
Expand All @@ -389,6 +408,9 @@ void FileSystem::importFromFile(std::string& filename) { // move this/create a b
else if (value == "buttons") {
// do stuff
continue;
} else {
std::cout << "Error: value is not int nor buttons" << std::endl; // Yes I needed this while coding...
return false;
}
}
std::string texture = line.substr(line.find(" - ") + 3, line.find(" -- ") - line.find(" - ") - 3);
Expand All @@ -403,5 +425,5 @@ void FileSystem::importFromFile(std::string& filename) { // move this/create a b
Drag.setScaleArray(scaleVector);
Drag.setButtonArray(buttonTexture);
file.close();

return true;
}
18 changes: 2 additions & 16 deletions RaylibFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class RaylibFunctionsClass {
std::vector<std::string> getUITextures(int pageNum);
void drawUI(std::vector<std::string> UI, Rectangle UIRects[], size_t arraySize, int pageNum, Vector2 triangles[6]); // create a better order of the args // Remove arraySize use UIRects[5]
Rectangle drawRightClickMenu(int textureNum, Vector2* texturePos, Camera2D* camera, std::vector<std::string> UI, Rectangle UIRects[5]); // just make UI global
bool allKeysReleased();
}; // Split UI functions to new class?
extern RaylibFunctionsClass Functions;

Expand Down Expand Up @@ -57,21 +58,6 @@ class DragSystem {
buttonTexture.clear();
}

void removeElementByString(const std::string& element) { // This function was dumb from the start and should just be removed
auto it = std::remove_if(textureMap.begin(), textureMap.end(),
[&](const auto& pair) {
return pair.first == element;
});
size_t index = std::distance(textureMap.begin(), it);
textureMap.erase(it, textureMap.end());
if (index < scales.size()) {
scales.erase(scales.begin() + index);
}
if (index < buttonTexture.size()) {
buttonTexture.erase(buttonTexture.begin() + index);
}
} // move to RaylibFunctions.cpp

void removeElementByNum(const int num);
};
extern DragSystem Drag;
Expand Down Expand Up @@ -102,5 +88,5 @@ class FileSystem {
private:
public:
void exportToFile(Rectangle rec, std::string& filename);
void importFromFile(std::string& filename);
bool importFromFile(std::string& filename);
};
Binary file removed RaylibGuiCreator
Binary file not shown.
1 change: 0 additions & 1 deletion build/.cmake/api/v1/query/client-vscode/query.json

This file was deleted.

Loading