| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Sdl2 OpenGL Mini Engine.
A small C game engine, that can be compiled to Desktop, Android, Web, ...
Using SDL2, OpenGL3.3, OpenGLES3.0, WebGL2.0 to be platform independent.
some's main goal is to create apps and games that run directly on the different platforms.
Also as a web version on smartphones!
Fork this repo and have fun. Have a look into some header files for some further explanation.
Just the hello world livedemo compiled with emscripten. See main.c
In the repository some_examples are some examples and modules to use for the some framework, like buttons, textinput, colorpicker, etc. The examples are well documented and easy to follow.
You want to support me?
Buy Pixelc Premium on Google Play. Its just like Pixelc, but with a dark background and gray scaled buttons.
Buy coins in EXTREME COIN STACKER on Google Play.
Options:
# update the system
sudo apt update && sudo apt upgrade
# install basic stuff for c coding
sudo apt install build-essential gdb git cmake
# install sdl stuff
# net, ttf are optional, see OPTION_SOCKET and OPTION_TTF
# mixer is not part of the some engine, but useful
sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-net-dev libsdl2-ttf-dev libsdl2-mixer-dev
# install curl (optional) for OPTION_FETCH
sudo apt install libcurl4-openssl-devWith WSL you can use all the awesome unix tools in Windows with an Ubuntu terminal. But you can not distribute your compiled programs, the users have to have WSL installed. See Windows MSYS2 or MSVC below, if you want to create an .exe to distribute for Windows
wsl --install
MSYS2 is a package manager for Windows, that can install the compiler Mingw-w64, which is a port of the GCC-Compiler with wrapper POSIX headers for Windows.
# basic stuff for c coding
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
pacman -S git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
# install sdl stuff
# net, ttf are optional, see OPTION_SOCKET and OPTION_TTF
# mixer is not part of the some engine, but useful
pacman -S mingw-w64-x86_64-glew mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-SDL2_net mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer
# install curl (optional) for OPTION_FETCH
pacman -S mingw-w64-x86_64-curl# add mingw32 lib to the path, in this dir should be the opengl libraries (dll) export PATH=$PATH:/c/msys64/mingw64/x86_64-w64-mingw32/lib
Close the terminal
If you use an IDE, you may need to add the PATH to ...mingw32/lib (see above) into the windows system variables
In Ubuntu, WSL Ubuntu or "MSYS2 MinGW x64" Terminal:
# clone the repo
git clone https://github.com/renehorstmann/some
# mv and make a build dir
cd some && mkdir build && cd build
# run cmake
cmake .. # [-DCMAKE_BUILD_TYPE=Release] for release mode
# compile
cmake --build . # [-- -j16] to compile with 16 threads...
# run
./someMSVC is the Microsoft C(++) Compiler, that comes with Visual Studio. The compiler can also be installed without the IDE.
we already installed the MSVC compiler, so no need to install Visual Studio, if you dont want that IDE
To install vcpk in PowerShell:
cd C:\
mkdir dev
cd dev
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
cd vcpkgcd C:\dev\vcpkg
# install sdl stuff
# net, ttf are optional, see OPTION_SOCKET and OPTION_TTF
# mixer is not part of the some engine, but useful
.\vcpkg install glew:x64-windows sdl2:x64-windows sdl2-image:x64-windows sdl2-net:x64-windows sdl2-ttf:x64-windows sdl2-mixer:x64-windows
# install curl (optional) for OPTION_FETCH
.\vcpkg install curl:x64-windowsIn the Powershell Terminal:
# clone the repo
git clone https://github.com/renehorstmann/some
# mv and make a build dir
cd some
mkdir build
cd build
#
# run cmake
# Note: you may have to edit the toolchain path for vcpkg
cmake .. -DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake # [-DCMAKE_BUILD_TYPE=Release] for release mode
# compile
cmake --build .
# run
.\Debug\some.exeAn IDE may also need the cmake option for the toolchain file
Useful to test and code on the go.
In fact, most of some's code, my games and apps were developed that way!
I recommend using a good Touchscreen-Keyboard-App with the right settings. In my case its the Samsung default keyboard (Samsung Galaxy Note 8, btw.). My recommended settings for the Samsung Keyboard:
I used the full/paid version of CxxDroid (from Google Play), other c compilers with SDL support may work, too
# update the system
pkg upgrade
# install basic stuff
pkg install git
# get access to the local file system of your android device from termux (needs the storage permission)
termux-setup-storage
# cd to your file system
cd ~/storage/shared
# optional, create a c projects folder
mkdir cprojects && cd cprojects
# clone the repo
git clone https://github.com/renehorstmann/someHave a look at the some_android AndroidStudio project generator template.
some compiles fine as website with wasm and webgl, that can also be used on mobile browsers.
Using the Emscripten compiler
Tested under Ubuntu and WSL Ubuntu (may work on Windows too, if the compile calls are changed).
You should have already cloned the project and cd to that dir:
mkdir web && cp index.html web && cp icon/* web && cd webcp -r ../res .emcc -O3 \
-I../include/ \
-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s FULL_ES3=1 -s \
EXPORTED_FUNCTIONS='["_main", "_e_io_idbfs_synced", "_e_io_file_upload_done"]' \
-s EXPORTED_RUNTIME_METHODS=FS,ccall \
-s SDL2_IMAGE_FORMATS='["png"]' \
--preload-file ./res \
-s ALLOW_MEMORY_GROWTH=1 -s ASYNCIFY=1 -s EXIT_RUNTIME=1 \
-lidbfs.js \
-DPLATFORM_EMSCRIPTEN -DOPTION_GLES -DOPTION_SDL \
../src/e/*.c ../src/p/*.c ../src/r/*.c ../src/u/*.c ../src/*.c \
-o index.jspython3 -m http.server --bind localhost # [port]fetch is more reliable than websockets, so SDL_net and OPTION_SOCKET are missing here
emcc -O3 \
-I../include/ \
-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_TTF=2 -s FULL_ES3=1 -s \
EXPORTED_FUNCTIONS='["_main", "_e_io_idbfs_synced", "_e_io_file_upload_done"]' \
-s EXPORTED_RUNTIME_METHODS=FS,ccall \
-s SDL2_IMAGE_FORMATS='["png"]' \
--preload-file ./res \
-s ALLOW_MEMORY_GROWTH=1 -s ASYNCIFY=1 -s EXIT_RUNTIME=1 -s FETCH=1 \
-lidbfs.js \
-DPLATFORM_EMSCRIPTEN -DOPTION_GLES -DOPTION_SDL -DOPTION_TTF -DOPTION_FETCH \
../src/e/*.c ../src/p/*.c ../src/r/*.c ../src/u/*.c ../src/*.c \
-o index.jsA function like: e_window_init got its name of:
Each component may have some basic function names:
*_init // initializes a (single member) module
*_new // returns a new component
*_new_* // special new
*_kill // deinitialize a comp.
*_update // update the internals
*_render // ...For more style rules used in my projects, see rhc/style
The some framework consists of a few packages, each for specific tasks:
e_* is for window and environment management, like window, input, sdl stuff...
r_* is for OpenGL rendering ro_* is for render objects
Utilities like setting up a 2D pose or loading an image
Physics (may be expanded later)
glsl like math library for C, see Mathc Renamed to namespace m
A C standard library addition, see rhc. Renamed to the namespace s
René Horstmann
This project is licensed under the MIT License - see the someLICENSE file for details
| Back | FazBrowse Home | New Git URL |