diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d71c53c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: ci.yml +on: + push: + branches: ['**'] + pull_request: +jobs: + build: + runs-on: ubuntu-26.04 + permissions: + contents: read + checks: write + + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Install gf + run : | + sudo apt-get update -y + sudo apt-get install libsdl2-dev libstb-dev libboost-dev libfreetype6-dev zlib1g-dev libpugixml-dev cmake -y + git clone https://github.com/GamedevFramework/gf.git + cd gf + git submodule update --init + mkdir build + cd build + cmake ../ -DGF_BUILD_GAMES=ON -DGF_BUILD_TOOLS=ON -DCMAKE_CXX_FLAGS="-include cstdint" + make + sudo make install + + - name: CMake + run: mkdir build && cd build && cmake .. + + - name: Build + run: cd build && make + +# A voir plus tard pour CI/CD linux, windows, macos diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..362b619 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +cmake-build-debug/ +build/ +.idea/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9a749ac --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,49 @@ +# How to use: +# mkdir build +# cd build +# cmake .. +# make +# +cmake_minimum_required(VERSION 3.10.2) + +project(STANK + VERSION 0.1.0) + +add_executable(stank src/client.cpp) + +find_package(gf 1.2.0 REQUIRED COMPONENTS graphics) + +target_link_libraries(stank + PRIVATE + gf::graphics +) + +target_compile_options(stank + PRIVATE + "-Wall" "-Wextra" "-pedantic" "-g" "-O2" +) + +set_target_properties(stank + PROPERTIES + CXX_STANDARD 17 + CXX_EXTENSIONS OFF +) + +add_executable(stank_server src/server.cpp) + +target_compile_options(stank_server + PRIVATE + "-Wall" "-Wextra" "-pedantic" "-g" "-O2" +) + +set_target_properties(stank_server + PROPERTIES + CXX_STANDARD 17 + CXX_EXTENSIONS OFF +) + +add_custom_command(TARGET stank POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + "${CMAKE_CURRENT_SOURCE_DIR}/data/stank" + "$/" +) \ No newline at end of file diff --git a/README.md b/README.md index 3e57f68..b639981 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # Stank -An online game made with gf in c++ + +![C++](https://img.shields.io/badge/c%2B%2B-%2300599C.svg?style=for-the-badge&logo=cplusplus&logoColor=white) +![CMake](https://img.shields.io/badge/CMake-%23008FBA.svg?style=for-the-badge&logo=cmake&logoColor=white) + +An online game made with [GamedevFramework](https://gamedevframework.github.io/) made in C++! + diff --git a/data/stank/DroidSans.ttf b/data/stank/DroidSans.ttf new file mode 100644 index 0000000..2537cc3 Binary files /dev/null and b/data/stank/DroidSans.ttf differ diff --git a/src/client.cpp b/src/client.cpp new file mode 100644 index 0000000..5388f73 --- /dev/null +++ b/src/client.cpp @@ -0,0 +1,45 @@ +// +// Created by azrotho on 09/10/2026. +// +#include +#include +#include +#include +#include +#include +#include +#include + +int main() { + std::cout << "Hello, World Client!" << std::endl; + + gf::Window window("Example", { 640, 480 }); + gf::RenderWindow renderer(window); + renderer.clear(gf::Color::White); + + gf::Font font("DroidSans.ttf"); + + gf::Text text("Hello gf!", font, 50); + text.setColor(gf::Color4f(0.0f,0.0f,0.0f,1.0f)); + text.setPosition({ 100, 100 }); + + while (window.isOpen()) { + // Process events + gf::Event event; + while (window.pollEvent(event)) { + switch (event.type) { + case gf::EventType::Closed: + window.close(); + break; + default: + break; + } + } + // Draw the entities + renderer.clear(); + //renderer.draw(sprite); + renderer.draw(text); + renderer.display(); + } + return 0; +} \ No newline at end of file diff --git a/src/server.cpp b/src/server.cpp new file mode 100644 index 0000000..533c8ba --- /dev/null +++ b/src/server.cpp @@ -0,0 +1,10 @@ +// +// Created by azrotho on 09/10/2026. +// + +#include + +int main() { + std::cout << "Hello, World Server!" << std::endl; + return 0; +} \ No newline at end of file