diff --git a/.github/TextScript_Terminal.jpg b/.github/TextScript_Terminal.jpg new file mode 100755 index 0000000..d409883 Binary files /dev/null and b/.github/TextScript_Terminal.jpg differ diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 7f6c4bd..53ae654 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ # Build files /bin /lib - +/.cache +/compile_commands.json # Engine folder /Engine/CMakeCache.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index d167a67..300d840 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.16) project(TextScript CXX) diff --git a/Engine/CMakeLists.txt b/Engine/CMakeLists.txt index b85f849..71a0248 100755 --- a/Engine/CMakeLists.txt +++ b/Engine/CMakeLists.txt @@ -1,10 +1,10 @@ -file(GLOB_RECURSE SOURCES "src/*.cpp" "src/Objects/*.cpp") +file(GLOB_RECURSE SOURCES "src/*.cpp" "src/Objects/*.cpp" "src/Event/*.cpp") list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/pch.cpp") add_library(Engine-pch OBJECT "${CMAKE_CURRENT_SOURCE_DIR}/src/pch.cpp") target_include_directories(Engine-pch PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -add_library(Engine SHARED ${SOURCES}) +add_library(Engine STATIC ${SOURCES}) target_link_libraries(Engine PRIVATE Engine-pch) target_link_libraries(Engine PUBLIC ncurses) diff --git a/Engine/include/Application.h b/Engine/include/Application.h old mode 100644 new mode 100755 index 706952f..b976f35 --- a/Engine/include/Application.h +++ b/Engine/include/Application.h @@ -1,16 +1,8 @@ #pragma once -#ifdef _WIN3 - #ifdef T_EXPORTS - #define TEXTSCRIPT_API __declspec(dllexport) - #else - #define TEXTSCRIPT_API __declspec(dllimport) - #endif -#else //Linux/macOS - #define TEXTSCRIPT_API -#endif - +#include "textscript_api.h" #include "pch.h" +#include "Event/Keyboard.h" namespace TextScript { class TEXTSCRIPT_API Application { @@ -24,12 +16,12 @@ namespace TextScript { virtual void OnStart(); virtual void OnUpdate(); - virtual void OnInput(const std::string& Key); + virtual void OnInput(KeyboardButtonPressEvent Key); private: bool m_IsRunning = true; std::string m_ApplicationName = ""; std::string m_CurrentKeyboardKey = ""; }; -}; // namespace TextScript +}; diff --git a/Engine/include/Event/Event.h b/Engine/include/Event/Event.h new file mode 100755 index 0000000..1c7ab59 --- /dev/null +++ b/Engine/include/Event/Event.h @@ -0,0 +1,17 @@ +#pragma once +#include "pch.h" + +namespace TextScript { + enum class EventType { + Base, + KeyboardKeyPress, + MouseMovement, + MouseButtonPress, + }; + + class BaseEvent { + public: + virtual std::string GetEventName(){ return "BaseEvent"; } + virtual EventType GetEventType(){ return EventType::Base; } + }; +} diff --git a/Engine/include/Event/Keyboard.h b/Engine/include/Event/Keyboard.h new file mode 100755 index 0000000..0cafd70 --- /dev/null +++ b/Engine/include/Event/Keyboard.h @@ -0,0 +1,26 @@ +#pragma once + +#include "pch.h" +#include "Event/Event.h" +#include + +namespace TextScript { + class KeyboardButtonPressEvent : BaseEvent { + public: + enum class ArrowKey{ + NONE, + UP, + DOWN, + LEFT, + RIGHT, + }; + + KeyboardButtonPressEvent(const std::string& Key); + ArrowKey GetArrowKeyPress(); + std::string GetEventName() override; + std::string GetKeyPress(); + private: + std::string m_Key = ""; + }; +} + diff --git a/Engine/include/Objects/BaseObject.h b/Engine/include/Objects/BaseObject.h old mode 100644 new mode 100755 index 70d82d2..8733b28 --- a/Engine/include/Objects/BaseObject.h +++ b/Engine/include/Objects/BaseObject.h @@ -1,9 +1,10 @@ #pragma once #include "pch.h" +#include "textscript_api.h" namespace TextScript { - class BaseObject { + class TEXTSCRIPT_API BaseObject { public: BaseObject(const std::string& name, int x=0, int y=0); unsigned short X = 0; diff --git a/Engine/include/Objects/TextObject.h b/Engine/include/Objects/TextObject.h old mode 100644 new mode 100755 index 0c135c8..fb02c93 --- a/Engine/include/Objects/TextObject.h +++ b/Engine/include/Objects/TextObject.h @@ -2,9 +2,10 @@ #include "pch.h" #include "Objects/BaseObject.h" +#include "textscript_api.h" namespace TextScript { - class TextObject : public TextScript::BaseObject { + class TEXTSCRIPT_API TextObject : public TextScript::BaseObject { public: TextObject(const std::string& name) : BaseObject(name) {} std::string Text = "█"; diff --git a/Engine/include/log.h b/Engine/include/log.h index 5c243f6..473fccd 100755 --- a/Engine/include/log.h +++ b/Engine/include/log.h @@ -1,17 +1,9 @@ #pragma once -#include -#ifdef _WIN32 - #ifdef T_EXPORTS - #define TEXTSCRIPT_API __declspec(dllexport) - #else - #define TEXTSCRIPT_API __declspec(dllimport) - #endif -#else // For Linux/macOS - #define TEXTSCRIPT_API -#endif +#include "pch.h" +#include "textscript_api.h" namespace TextScript { - namespace Logger { + namespace TEXTSCRIPT_API Logger { TEXTSCRIPT_API void log_info(std::string message); TEXTSCRIPT_API void log_warn(std::string message); TEXTSCRIPT_API void log_error(std::string message); diff --git a/Engine/include/textscript_api.h b/Engine/include/textscript_api.h new file mode 100755 index 0000000..8e1f8f8 --- /dev/null +++ b/Engine/include/textscript_api.h @@ -0,0 +1,11 @@ +#pragma once + +#ifdef _WIN32 + #ifdef T_EXPORTS + #define TEXTSCRIPT_API __declspec(dllexport) + #else + #define TEXTSCRIPT_API __declspec(dllimport) + #endif +#else // For Linux/macOS + #define TEXTSCRIPT_API +#endif diff --git a/Engine/src/Application.cpp b/Engine/src/Application.cpp old mode 100644 new mode 100755 index ea1ee6d..621dbea --- a/Engine/src/Application.cpp +++ b/Engine/src/Application.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "Application.h" #include "log.h" +#include "Event/Keyboard.h" namespace TextScript { Application::Application(std::string name) @@ -22,11 +23,11 @@ namespace TextScript { m_CurrentKeyboardKey = getch(); if (m_CurrentKeyboardKey == ""){} else { - OnInput(m_CurrentKeyboardKey); - m_CurrentKeyboardKey = ""; + KeyboardButtonPressEvent Key(m_CurrentKeyboardKey); + OnInput(Key); } - std::this_thread::sleep_for(std::chrono::milliseconds(100)); // sleep for 0.1 second + } } @@ -34,7 +35,7 @@ namespace TextScript { void Application::Close() { m_IsRunning = false; endwin(); - LOG_INFO("\033[48;5;208m\033[37m Engine \033[0m User exited Application"); + LOG_INFO("\033[48;5;208m\033[37m Engine \033[0m exited Application"); } void Application::RefreshScreen(){ @@ -48,7 +49,7 @@ namespace TextScript { void Application::OnUpdate() { // Override in derived class } - void Application::OnInput(const std::string& Key){ + void Application::OnInput(KeyboardButtonPressEvent Key){ // Override in derived class } } // namespace TextScript diff --git a/Engine/src/Event/Event.cpp b/Engine/src/Event/Event.cpp new file mode 100755 index 0000000..d2bb213 --- /dev/null +++ b/Engine/src/Event/Event.cpp @@ -0,0 +1,5 @@ +#include "pch.h" + +namespace TextScript { + +} diff --git a/Engine/src/Event/Keyboard.cpp b/Engine/src/Event/Keyboard.cpp new file mode 100755 index 0000000..f6b4ba6 --- /dev/null +++ b/Engine/src/Event/Keyboard.cpp @@ -0,0 +1,38 @@ +#include "Event/Keyboard.h" +#include "pch.h" + +namespace TextScript{ + KeyboardButtonPressEvent::KeyboardButtonPressEvent(const std::string& Key) + : m_Key(Key){ + + } + std::string KeyboardButtonPressEvent::GetEventName() { + return "KeyboardButtonPressEvent"; + } + KeyboardButtonPressEvent::ArrowKey KeyboardButtonPressEvent::GetArrowKeyPress() { + if (m_Key[0] >= 0 && m_Key[0] <= 255){ + return ArrowKey::NONE; + } + else{ + switch (m_Key[0]){ + case KEY_UP: + return ArrowKey::UP; + break; + case KEY_DOWN: + return ArrowKey::DOWN; + break; + case KEY_LEFT: + return ArrowKey::LEFT; + break; + case KEY_RIGHT: + return ArrowKey::RIGHT; + break; + } + } + } + std::string KeyboardButtonPressEvent::GetKeyPress(){ + if (m_Key[0] >= 0 && m_Key[0] <= 255) { + return m_Key; + } + } +} diff --git a/Engine/src/Objects/BaseObject.cpp b/Engine/src/Objects/BaseObject.cpp old mode 100644 new mode 100755 diff --git a/Engine/src/Objects/TextObject.cpp b/Engine/src/Objects/TextObject.cpp old mode 100644 new mode 100755 index 311ad25..928935a --- a/Engine/src/Objects/TextObject.cpp +++ b/Engine/src/Objects/TextObject.cpp @@ -4,7 +4,6 @@ namespace TextScript { void TextObject::Draw(){ clear(); - move(Y, X); - addstr(Text.c_str()); + mvprintw(Y, X, "%s", Text.c_str()); } } diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index ff2da49..9187bcb --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # TextScript a conosle base game engine made with C++(Ncurses) and Cmake + ## How to Run first clean any unwanted files ```bash @@ -23,6 +24,51 @@ int main() { return 0; } +``` + +sandbox.h: +```cpp +#pragma once +#include "TextScript.h" + +class Game : public TextScript::Application { +public: + Game(const std::string& name) + : TextScript::Application(name), player("player") {} + + void OnStart() override { + // This function is called once at the start of the application. + LOG_INFO("Application is working"); + LOG_INFO("Object name is " + player.GetName() + " and ID=" + player.GetObjectID()); + player.X = 0; + player.Y = 0; + LOG_INFO("Player position x:" + std::to_string(player.X) + " y:" + std::to_string(player.Y)); + } + + void OnUpdate() override { + // This function is called every frame. + player.Draw(); + RefreshScreen(); + } + + void OnInput(TextScript::KeyboardButtonPressEvent Key) override { + // This function handles keyboard input. + if (Key.GetKeyPress() == "d") { + player.X++; + } + if (Key.GetKeyPress() == "a") { + player.X--; + } + if (Key.GetKeyPress() == "q") { + Close(); // Quits the application. + } + } + +private: + TextScript::TextObject player; +}; + + ``` top level CMakeLists.txt: diff --git a/Sandbox/include/sandbox.h b/Sandbox/include/sandbox.h old mode 100644 new mode 100755 index 07b9eba..ea9f8c8 --- a/Sandbox/include/sandbox.h +++ b/Sandbox/include/sandbox.h @@ -1,6 +1,6 @@ #pragma once #include "TextScript.h" -#include + class Game : public TextScript::Application { public: @@ -11,6 +11,7 @@ class Game : public TextScript::Application { LOG_INFO("Application is working"); LOG_INFO("object name is " + player.GetName() + " and id=" + player.GetObjectID()); player.X = 0; + LOG_INFO("player position x:"+ std::to_string(player.X) + " y:"+ std::to_string(player.Y) ); } void OnUpdate() override { @@ -18,16 +19,21 @@ class Game : public TextScript::Application { RefreshScreen(); } - void OnInput(const std::string& Key) override { - if (Key == "d" ) { + void OnInput(TextScript::KeyboardButtonPressEvent Key) override { + if (Key.GetKeyPress() == "d" ) { player.X++; } - if (Key == "a") { + if (Key.GetKeyPress() == "a") { player.X--; } - if (Key == "q"){ - Close(); - + if (Key.GetKeyPress() == "q"){ + Close(); + } + if (Key.GetKeyPress() == "s"){ + player.Y--; + } + if (Key.GetKeyPress() == "w") { + player.Y++; } } private: diff --git a/clean.bat b/clean.bat new file mode 100755 index 0000000..8acc59c --- /dev/null +++ b/clean.bat @@ -0,0 +1,49 @@ +@echo off +setlocal + +:: Define the directories to clean +set "DIRECTORIES=.\ .\%~dp0Sandbox\ .\%~dp0Engine\" + +:: Define the files and directories to remove +set "REMOVE_TARGETS=CMakeCache.txt CMakeFiles cmake_install.cmake Makefile build bin lib install" + +:: A counter to track if anything was removed +set "CLEANED_SOMETHING=0" + +echo Starting CMake cleanup process... + +:: Loop through each specified directory +for %%d in (%DIRECTORIES%) do ( + echo. + echo Searching for files in: "%%d" + + :: Check if the directory exists + if exist "%%d" ( + :: Loop through each target to remove + for %%t in (%REMOVE_TARGETS%) do ( + :: Use 'if exist' to check for the file or directory before attempting to delete + if exist "%%d%%t" ( + echo - Removing %%d%%t + rd /s /q "%%d%%t" >nul 2>&1 + if not errorlevel 1 ( + set "CLEANED_SOMETHING=1" + ) + ) + ) + ) else ( + echo Warning: Directory not found: "%%d" + ) +) + +echo. +echo Cleanup complete. +echo. + +if %CLEANED_SOMETHING% equ 0 ( + echo No CMake files or directories were found to remove. +) else ( + echo Successfully removed specified CMake build artifacts. +) + +endlocal + diff --git a/compile_commands.json b/compile_commands.json new file mode 100755 index 0000000..b76f9e4 --- /dev/null +++ b/compile_commands.json @@ -0,0 +1,68 @@ +[ +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -o CMakeFiles/Engine-pch.dir/src/pch.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/pch.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/pch.cpp", + "output": "Engine/CMakeFiles/Engine-pch.dir/src/pch.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -fpch-instantiate-templates -Xclang -emit-pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -x c++-header -o CMakeFiles/Engine.dir/cmake_pch.hxx.pch -c /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.cxx", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.cxx", + "output": "Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -o CMakeFiles/Engine.dir/src/Application.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/Application.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/Application.cpp", + "output": "Engine/CMakeFiles/Engine.dir/src/Application.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -o CMakeFiles/Engine.dir/src/Event/Event.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/Event/Event.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/Event/Event.cpp", + "output": "Engine/CMakeFiles/Engine.dir/src/Event/Event.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -o CMakeFiles/Engine.dir/src/Event/Keyboard.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/Event/Keyboard.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/Event/Keyboard.cpp", + "output": "Engine/CMakeFiles/Engine.dir/src/Event/Keyboard.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -o CMakeFiles/Engine.dir/src/Objects/BaseObject.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/Objects/BaseObject.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/Objects/BaseObject.cpp", + "output": "Engine/CMakeFiles/Engine.dir/src/Objects/BaseObject.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -o CMakeFiles/Engine.dir/src/Objects/TextObject.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/Objects/TextObject.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/Objects/TextObject.cpp", + "output": "Engine/CMakeFiles/Engine.dir/src/Objects/TextObject.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -o CMakeFiles/Engine.dir/src/TextScript.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/TextScript.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/TextScript.cpp", + "output": "Engine/CMakeFiles/Engine.dir/src/TextScript.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Engine", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Engine/CMakeFiles/Engine.dir/cmake_pch.hxx -o CMakeFiles/Engine.dir/src/log.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Engine/src/log.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Engine/src/log.cpp", + "output": "Engine/CMakeFiles/Engine.dir/src/log.cpp.o" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Sandbox", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Sandbox/include -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -fpch-instantiate-templates -Xclang -emit-pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Sandbox/CMakeFiles/Sandbox.dir/cmake_pch.hxx -x c++-header -o CMakeFiles/Sandbox.dir/cmake_pch.hxx.pch -c /storage/FF45-1DF4/Projects/TextScript/Sandbox/CMakeFiles/Sandbox.dir/cmake_pch.hxx.cxx", + "file": "/storage/FF45-1DF4/Projects/TextScript/Sandbox/CMakeFiles/Sandbox.dir/cmake_pch.hxx.cxx", + "output": "Sandbox/CMakeFiles/Sandbox.dir/cmake_pch.hxx.pch" +}, +{ + "directory": "/storage/FF45-1DF4/Projects/TextScript/Sandbox", + "command": "/data/data/com.termux/files/usr/bin/c++ -DT_EXPORTS -I/storage/FF45-1DF4/Projects/TextScript/Sandbox/include -I/storage/FF45-1DF4/Projects/TextScript/Engine/include -O2 -g -DNDEBUG -Winvalid-pch -Xclang -include-pch -Xclang /storage/FF45-1DF4/Projects/TextScript/Sandbox/CMakeFiles/Sandbox.dir/cmake_pch.hxx.pch -Xclang -include -Xclang /storage/FF45-1DF4/Projects/TextScript/Sandbox/CMakeFiles/Sandbox.dir/cmake_pch.hxx -o CMakeFiles/Sandbox.dir/src/main.cpp.o -c /storage/FF45-1DF4/Projects/TextScript/Sandbox/src/main.cpp", + "file": "/storage/FF45-1DF4/Projects/TextScript/Sandbox/src/main.cpp", + "output": "Sandbox/CMakeFiles/Sandbox.dir/src/main.cpp.o" +} +] \ No newline at end of file diff --git a/message.txt b/message.txt old mode 100644 new mode 100755 diff --git a/run b/run index 8f788f1..9e3e3c4 100755 --- a/run +++ b/run @@ -7,7 +7,7 @@ if [[ -d "$CMAKE_FILES" ]]; then echo "cmake files found" else echo "CMakeFiles not found. running cmake" - cmake . + cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON fi diff --git a/run.bat b/run.bat new file mode 100755 index 0000000..14bbdfc --- /dev/null +++ b/run.bat @@ -0,0 +1,31 @@ +@echo off +setlocal + +set "CMAKE_FILES=.\CMakeFiles" + +if exist "%CMAKE_FILES%" ( + echo cmake files found +) else ( + echo CMakeFiles not found. running cmake + cmake . +) + +if "%~1"=="" ( + echo build and run + echo Usage: %~nx0 ^ + exit /b 1 +) + +set EXECUTABLE_NAME=%~1 + +cls + +type message.txt +echo %EXECUTABLE_NAME% + +cmake --build . + +echo. +echo running App +".\bin\%EXECUTABLE_NAME%.exe" +