Skip to content

Commit

Permalink
Adds cSprite, sprite rendering and documents (#193)
Browse files Browse the repository at this point in the history
* Adds cSprite, sprite rendering and add demo

* Update README.md
  • Loading branch information
Jerboa-app authored Aug 22, 2024
1 parent f7d95fd commit 2827a7d
Show file tree
Hide file tree
Showing 40 changed files with 1,179 additions and 374 deletions.
44 changes: 20 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
include/vendored/ogg/include/ogg \
include/vendored/sparsehash;
do cp -r $inc headers; done
ls headers
- name: pack headers mingw
Expand All @@ -74,7 +74,7 @@ jobs:
with:
name: headers
path: headers

- name: build header-mingw artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -88,15 +88,15 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential xorg-dev mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev libxinerama-dev libxcursor-dev vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools

- name: linux-linux
run: |
git submodule update --recursive
./build.sh -t -d -r
mkdir linuxbuild
mkdir linuxbuild
cp build/libHop.a linuxbuild/libHop-linux-x86_64.a
cp build/libjGL.a linuxbuild/libjGL-linux-x86_64.a
cp LICENSE* linuxbuild/
Expand Down Expand Up @@ -126,15 +126,15 @@ jobs:
with:
name: demoLinux
path: demos.zip

linuxXwindows:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix libxinerama-dev libxcursor-dev vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools wine64

Expand All @@ -152,7 +152,7 @@ jobs:
cp -r build/PerlinWorld demos/
cp build/*.dll demos/PerlinWorld/
cd demos && zip -r ../demos.zip * && cd ..
cp build/*.dll build/TestScriptPack/
cp build/*.dll build/TestScriptPack/
- name: Tests (wine64)
working-directory: ${{github.workspace}}/build
Expand All @@ -164,7 +164,7 @@ jobs:
sudo Xvfb :99 -screen 0 800x600x24 &
sleep 5
MESA_GL_VERSION_OVERRIDE=3.3 ctest --output-on-failure --verbose --exclude-regex Vulkan
- name: buildArtifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
cp build/libHop.a macosbuild/libHop-macos.a
cp build/libjGL.a macosbuild/libjGL-macos.a
cp LICENSE* macosbuild/
mkdir demos
cp -r build/PerlinWorld demos/
cd demos && zip -r ../demos.zip * && cd ..
Expand All @@ -214,7 +214,7 @@ jobs:
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: MESA_GL_VERSION_OVERRIDE=3.3 ctest --output-on-failure --verbose --exclude-regex Vulkan --exclude-regex assetStore

- name: buildArtifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -226,11 +226,11 @@ jobs:
with:
name: demomacos
path: demos.zip

linuxRun:
needs: linuxNative
runs-on: ubuntu-20.04

steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y xvfb x11-apps imagemagick
Expand Down Expand Up @@ -258,8 +258,7 @@ jobs:
sleep 10
xwd -root -silent | convert xwd:- png:screenshot-map.png
sleep 5 && kill $PID
- name: upload artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -280,13 +279,13 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools
wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip
unzip android-ndk-r25c-linux.zip
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
unzip commandlinetools-linux-9477386_latest.zip
export ANDROID_SDK_ROOT=~/
mv cmdline-tools latest
Expand All @@ -297,12 +296,12 @@ jobs:
./cmdline-tools/latest/bin/sdkmanager --install "system-images;android-34;google_apis;x86_64"
./cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-34"
echo no | ./cmdline-tools/latest/bin/avdmanager create avd --name android34 --package "system-images;android-34;google_apis;x86_64"
- name: build hop
run: |
git submodule update --recursive
./build.sh -r --android android-ndk-r25c
mkdir androidbuild
mkdir androidbuild
cp build/libHop* androidbuild/
cp build/libjGL* androidbuild/
cp LICENSE* androidbuild/
Expand Down Expand Up @@ -359,7 +358,6 @@ jobs:
runs-on: ubuntu-22.04

steps:

- uses: actions/checkout@v4
with:
submodules: 'true'
Expand Down Expand Up @@ -396,7 +394,6 @@ jobs:
runs-on: ubuntu-22.04

steps:

- uses: actions/checkout@v4
with:
submodules: 'true'
Expand Down Expand Up @@ -431,7 +428,6 @@ jobs:
runs-on: macos-12

steps:

- uses: actions/checkout@v4
with:
submodules: 'true'
Expand Down Expand Up @@ -474,14 +470,14 @@ jobs:
needs: [linuxNative, linuxXwindows, linuxXandroid, macosNative, headers]
if: github.ref_type == 'tag'
runs-on: ubuntu-20.04

steps:
- name: get linux build
uses: actions/download-artifact@v4
with:
name: linuxbuild
path: linux

- name: get windows build
uses: actions/download-artifact@v4
with:
Expand All @@ -493,7 +489,7 @@ jobs:
with:
name: macosbuild
path: macos

- name: get android build
uses: actions/download-artifact@v4
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Hop run tests
name: Hop demos

on:
pull_request:
Expand All @@ -10,13 +10,13 @@ jobs:

strategy:
matrix:
example: [PerlinWorld, SoftBodyTetris, MeshEditor]
example: [PerlinWorld, SoftBodyTetris, Sprites, MeshEditor]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential xorg-dev mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev libxinerama-dev libxcursor-dev xvfb x11-apps vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools

Expand Down Expand Up @@ -46,16 +46,16 @@ jobs:
wineRunTest:
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-22.04

strategy:
matrix:
example: [PerlinWorld, SoftBodyTetris, MeshEditor]
example: [PerlinWorld, SoftBodyTetris, Sprites, MeshEditor]

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y xorg-dev build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix libxinerama-dev libxcursor-dev xvfb x11-apps vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools wine64
- name: linux-windows
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ IF (TEST_SUITE)
file(GLOB TEST_SRC "tests/*.cpp" "src/Maths/*.cpp")
include_directories(include "tests/")

add_executable(testSuite
add_executable(testSuite
${TEST_SRC}
"src/World/mapFile.cpp"
"src/Util/z.cpp"
Expand All @@ -187,15 +187,15 @@ IF (TEST_SUITE)
target_compile_definitions(testSuite PUBLIC GLSL_VERSION="330")

target_link_libraries(testSuite zlibstatic stduuid glm)

include(CTest)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/tests/cmake/)
include(Catch)
catch_discover_tests(testSuite)

add_subdirectory("${PROJECT_SOURCE_DIR}/tests/regression")
endif()

ENDIF(TEST_SUITE)

endif()
74 changes: 63 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,70 @@
# Hop

A lightweight 2D game engine, in C++ with embedded Lua
#### A lightweight 2D game engine, in C++ with embedded Lua

### Features

- Free, MIT open sourced
- Use as a standalone (GLFW based) engine or as a drop in component (e.g. with SFML)
- Entity component system (ECS) based
- Rigid and soft body physics (Discrete element method)
- OpenGL rendering (provided by jGL, Vulkan is a WIP)
- Perlin (marching squares) and Tile map, editable tile based worlds
- Lua console, interoperating with the ECS, physics, and rendering systems
- Free, MIT open sourced..
- Use as a standalone engine or as a drop in component (e.g. with SFML)..
- Entity component system (ECS) based.
- Physics (Discrete element method):
- [x] collision primitives (circles, rects).
- [x] collision meshes built from primitives (rigid and soft).
- [x] configurable friction, gravity, drag, and restitution.
- [x] super-sampling.
- [ ] (good) multithreading.
- [x] Cell list collision detection.
- [ ] Quad tree collision detection.
- [x] Object-object and object-world collisions.
- [ ] collision islands and other optimisations.
- Rendering (provided by jGL, Vulkan is a WIP):
- [x] OpenGL.
- [ ] Vulkan.
- [x] sprites (atlasing, and animateable atlases).
- [x] collision primitives (circles/rects).
- [x] Freetype fonts.
- [ ] shapes (it is in jGL).
- [ ] lightmaps and shadows.
- [x] msaa.
- [ ] particle effects (it is in jGL).
- [x] texture management.
- [ ] (compressed) texture asset packs.
- [ ] Engine UI (Dear ImGui).
- Window management:
- [x] Single window creation.
- [ ] Multi-window.
- [x] Key and mouse events.
- [x] Frame limiting.
- [ ] Snapping and resizing.
- [x] Screenspace bbs.
- Worlds:
- [x] Perlin (marching squares).
- [x] Tile maps.
- [x] object-world collisions.
- [ ] editable.
- [x] saveable.
- [ ] tile textures.
- Lua console
- [x] ECS bindings (object management).
- [x] Compressed script asset archive support.
- [ ] Live in game console
- Cross platform:
- [x] Linux.
- [x] Windows.
- [x] macOS.
- [x] Android.
- [ ] IOS (mostly held up by jGL rendering).
- Tooling
- [x] mesh editor.
- [x] Lua script packer.
- [ ] World editor.
- [ ] Texture packer.

### Setup
### Documentation

Checkout the docs [here](https://jerboaburrow.github.io/Hop/), and also the jGL docs [here](https://jerboaburrow.github.io/jGL/)

### Setup

- clone, and init the submodules (you can use ```submodules.sh```)
- the ```build.sh``` can be used to build
Expand All @@ -21,12 +73,12 @@ A lightweight 2D game engine, in C++ with embedded Lua

- Freetype is licensed under the The FreeType Project LICENSE
- GLEW is licensed under aModified BSD License, the Mesa 3-D License (MIT) and the Khronos License (MIT).
- GLFW is licensed under the zlib/libpng
- GLFW is licensed under the zlib/libpng
- GLM is licensed under the MIT License (but also, no bunnies have been made unhappy)
- Lua is licensed under the MIT license
- Miniaudio is licensed under the MIT-0 license
- stduuid is licensed under the MIT license
- vorbis and ogg is licensed under a BSD license
- zlib is licensed under the zlib license

We thank: David Turner, Robert Wilhelm, and Werner Lemberg (Freetype), Milan Ikits <milan ikits[]ieee org>, Marcelo E. Magallon <mmagallo[]debian org>, and Lev Povalahev Brian Paul, The Khronos Group Inc (GLEW), Marcus Geelnard and Camilla Löwy (GLFW), G-Truc Creation (GLM), Lua.org, PUC-Rio (Lua), David Reid (Miniaudio), Marius Bancila https://github.com/mariusbancila/stduuid#MIT-1-ov-file (stduuid), Xiph.org Foundation (vorbis, ogg), and Jean-loup Gailly and Mark Adler (zlib).
Thanks to all the OSS developers: David Turner, Robert Wilhelm, and Werner Lemberg (Freetype), Milan Ikits <milan ikits[]ieee org>, Marcelo E. Magallon <mmagallo[]debian org>, and Lev Povalahev Brian Paul, The Khronos Group Inc (GLEW), Marcus Geelnard and Camilla Löwy (GLFW), G-Truc Creation (GLM), Lua.org, PUC-Rio (Lua), David Reid (Miniaudio), Marius Bancila https://github.com/mariusbancila/stduuid#MIT-1-ov-file (stduuid), Xiph.org Foundation (vorbis, ogg), and Jean-loup Gailly and Mark Adler (zlib).
3 changes: 2 additions & 1 deletion demo/desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(perlinWorld)
add_subdirectory(softBodyTetris)
add_subdirectory(softBodyTetris)
add_subdirectory(sprites)
25 changes: 24 additions & 1 deletion demo/desktop/perlinWorld/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
add_subdirectory(standalone)
set(OUTPUT_NAME PerlinWorld)

if (WINDOWS)
add_compile_definitions(WINDOWS)

if (RELEASE)
# launch as windows, not console app - so cmd does not open as well
add_link_options(-mwindows)
endif ()
else ()
add_link_options(-no-pie)
endif()

add_executable(${OUTPUT_NAME} "main.cpp")

target_link_libraries(${OUTPUT_NAME} Hop)

set_target_properties(${OUTPUT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OUTPUT_NAME}/")

file(GLOB LUA "*.lua")
file(GLOB MAP "*.hmap")

file(COPY ${LUA} DESTINATION "${CMAKE_BINARY_DIR}/${OUTPUT_NAME}/")
file(COPY ${MAP} DESTINATION "${CMAKE_BINARY_DIR}/${OUTPUT_NAME}/")
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2827a7d

Please sign in to comment.