Skip to content

A prototype game engine that gets improved as I learn new things. Uses OpenGL, SDL2, and Vulkan (at some point.)

License

Notifications You must be signed in to change notification settings

Midou36O/SDL_Gravity_Box

Repository files navigation

DeepSource

SDL_Gravity_Box

Making a "windowed" 2D box that makes the ball move when moving the window (just like an actual box in real life!)

Preview

Preview

Controls (hardcoded)

a z e  | down forward  up
q s d  | left backward right

r: resets the window and position of the characters.
space: pause | play the music.
a: quit.
k: resize to 1080p.
f: full screen.
scroll wheel: increase / decrease speed.

Why do i make this

Because i absolutely fucking hate myself and i have to make something like that for a game (not free) i'm planning to code after exams.

How do i compile it !11!1!1!1!1!1

Windows (CMake)

Get Visual Studio 2022 (with C++ Development selected in the installer, of course) and vcpkg. With vcpkg installed, run vcpkg install sdl2, vcpkg install sdl2-image (it's possible you might have to pass --triplet x64-windows). Then integrate it with Visual Studio 2022 by running vcpkg integrate install.

Create a new folder called "build" and change directory into it: mkdir build; cd build.

To use vcpkg packages with CMake, run cmake -B . -S .. -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake. You can then build with cmake --build ..

Linux (CMake)

Install SDL2 and SDL2_image development libraries from your distribution's package manager. Use a search engine to find the package names for these.

Create a new folder called "build" and change directory into it: mkdir build; cd build.

Generate build files with cmake ... You can then build with cmake --build ..

Make and Ninja both work and are the only ones I have tested.

Linux (Make/G++) (Deprecated)

** Please use the CMake options up there from now on, if there are issues make a PR or an issue for me to know. **

Look here

or simply run this

g++ -c src/*.cpp src/*.c src/vertx/*.cpp src/inc/submodules/imgui/imgui*.cpp src/inc/submodules/imgui/backends/imgui_impl_sdl2.cpp src/inc/submodules/imgui/backends/imgui_impl_opengl3.cpp -std=c++14 -m64 -g -Wall -I src/inc -I src/inc/submodules/imgui/ -I src/inc/submodules/imgui/backends/ -I /usr/include/SDL2 && g++ *.o -o bin/debug/main -lGL -lSDL2main -lSDL2 -lSDL2_image -lSDL2_mixer -limgui

Just consider this repo a sandbox for shit i make lol

About

A prototype game engine that gets improved as I learn new things. Uses OpenGL, SDL2, and Vulkan (at some point.)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published