mirror of https://github.com/auygun/kaliber.git
Compare commits
5 Commits
0a78316bce
...
2d35d0ef53
Author | SHA1 | Date |
---|---|---|
Attila Uygun | 2d35d0ef53 | |
Attila Uygun | b06092ef8d | |
Attila Uygun | 66990f26ba | |
Attila Uygun | 7c148d7555 | |
Attila Uygun | 1b6352b775 |
|
@ -5,7 +5,7 @@
|
|||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch",
|
||||
"name": "Debug demo - Linux",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/out/debug/demo",
|
||||
|
@ -25,7 +25,7 @@
|
|||
"preLaunchTask": "Build project",
|
||||
},
|
||||
{
|
||||
"name": "C/C++: cl.exe build and debug active file",
|
||||
"name": "Debug demo - Windows",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}\\out\\debug\\demo.exe",
|
||||
|
@ -34,6 +34,7 @@
|
|||
"cwd": "${workspaceFolder}\\out\\debug",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"preLaunchTask": "Build project",
|
||||
}
|
||||
]
|
||||
}
|
20
README.md
20
README.md
|
@ -1,21 +1,20 @@
|
|||
# Kaliber
|
||||
|
||||
A simple, cross-platform 2D game engine with OpenGL and Vulkan renderers.
|
||||
Supports Linux and Android platforms.
|
||||
Supports Linux, Windows and Android platforms.
|
||||
This is a personal hobby project. I've published a little game on
|
||||
[Google Play](https://play.google.com/store/apps/details?id=com.woom.game)
|
||||
based on this engine. Full game code and assets are included in this repository.
|
||||
|
||||
## Pre-requisites:
|
||||
|
||||
**GN build system** is required for all platforms except Android (support for
|
||||
APKs, Java code etc. is to be added to the GN configuration). \
|
||||
Building GN from source:
|
||||
https://gn.googlesource.com/gn/ \
|
||||
Pre-built GN binaries:
|
||||
https://chrome-infra-packages.appspot.com/p/gn/gn/
|
||||
**GN build system** is required for all platforms except Android:\
|
||||
https://gn.googlesource.com/gn/
|
||||
|
||||
Linux is the supported host platform to build Android. **Gradle**,
|
||||
**Build Tools** is required to build for Windows. if you prefer, you can install
|
||||
**Visual Studio** which includes the **Build Tools**.
|
||||
|
||||
Linux is the supported host platform to build for Android. **Gradle**,
|
||||
**Android SDK** and **NDK** are required. If you prefer, you can install
|
||||
**Android Studio** which includes all the requirements.
|
||||
|
||||
|
@ -25,7 +24,7 @@ Linux is the supported host platform to build Android. **Gradle**,
|
|||
Setup:
|
||||
```text
|
||||
gn gen out/release
|
||||
gn gen --args='is_debug=true' out/debug
|
||||
gn gen --args="is_debug=true" out/debug
|
||||
```
|
||||
Building and running:
|
||||
```text
|
||||
|
@ -33,6 +32,9 @@ ninja -C out/debug
|
|||
./out/debug/hello_world
|
||||
./out/debug/demo
|
||||
```
|
||||
Building and debugging from VS Code:
|
||||
* Select "Debug demo - [platform]" from the "Run and Debug" drop down.
|
||||
* Press F5.
|
||||
### Android:
|
||||
```text
|
||||
cd build/android
|
||||
|
|
|
@ -203,6 +203,8 @@ config("warnings") {
|
|||
"/wd4305", # truncation from 'double' to 'float'.
|
||||
"/wd4365", # conversion, signed/unsigned mismatch.
|
||||
# "/wd5219", # conversion, possible loss of data. 'int' to 'float'
|
||||
"/wd4722", # destructor never returns, potential memory leak
|
||||
"/wd4702", # unreachable code
|
||||
|
||||
# Possible compiler bug? Needs investigation.
|
||||
"/wd4668", # '__STDC_WANT_SECURE_LIB__' is not defined as a preprocessor
|
||||
|
|
|
@ -134,9 +134,11 @@ add_library(kaliber SHARED
|
|||
../../../src/third_party/glslang/SPIRV/SPVRemapper.cpp
|
||||
../../../src/third_party/glslang/SPIRV/SpvTools.cpp
|
||||
../../../src/third_party/jsoncpp/jsoncpp.cpp
|
||||
../../../src/third_party/minimp3/minimp3.cc
|
||||
../../../src/third_party/minizip/ioapi.c
|
||||
../../../src/third_party/minizip/unzip.c
|
||||
../../../src/third_party/spirv-reflect/spirv_reflect.c
|
||||
../../../src/third_party/stb/stb_image.cc
|
||||
../../../src/third_party/texture_compressor/dxt_encoder_internals.cc
|
||||
../../../src/third_party/texture_compressor/dxt_encoder.cc
|
||||
../../../src/third_party/texture_compressor/texture_compressor_etc1.cc
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <android/log.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#include <format>
|
||||
#else
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#endif
|
||||
#include <cstdlib>
|
||||
#include <format>
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
@ -38,14 +38,17 @@ LogMessage::~LogMessage() {
|
|||
size_t last_slash_pos = filename.find_last_of("\\/");
|
||||
if (last_slash_pos != std::string::npos)
|
||||
filename = filename.substr(last_slash_pos + 1);
|
||||
std::string log_str = std::format("{} [{}:{}] {}", verbosity_level_,
|
||||
filename.c_str(), line_, message.c_str());
|
||||
#if defined(__ANDROID__)
|
||||
__android_log_print(ANDROID_LOG_ERROR, "kaliber", "%s", log_str.c_str());
|
||||
__android_log_print(ANDROID_LOG_ERROR, "kaliber", "%d [%s:%d] %s",
|
||||
verbosity_level_, filename.c_str(), line_,
|
||||
message.c_str());
|
||||
#elif defined(_WIN32)
|
||||
OutputDebugStringA(log_str.c_str());
|
||||
OutputDebugStringA(
|
||||
std::format("{} [{}:{}] {}", verbosity_level_, filename, line_, message)
|
||||
.c_str());
|
||||
#else
|
||||
std::clog << log_str;
|
||||
printf("%d [%s:%d] %s", verbosity_level_, filename.c_str(), line_,
|
||||
message.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,7 @@ source_set("engine") {
|
|||
libs = []
|
||||
|
||||
if (target_os == "linux" || target_os == "win") {
|
||||
sources += [
|
||||
"platform/asset_file_generic.cc",
|
||||
]
|
||||
sources += [ "platform/asset_file_generic.cc" ]
|
||||
}
|
||||
|
||||
if (target_os == "linux") {
|
||||
|
|
|
@ -2,21 +2,29 @@
|
|||
#define ENGINE_RENDERER_OPENGL_OPENGL_H
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
// Use the modified Khronos header from ndk-helper. This gives access to
|
||||
// additional functionality the drivers may expose but which the system headers
|
||||
// do not.
|
||||
#include "third_party/android/gl3stub.h"
|
||||
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
||||
#include "third_party/glew/glew.h"
|
||||
#include "third_party/glew/glxew.h"
|
||||
|
||||
#elif defined(_WIN32)
|
||||
|
||||
#define GLEW_STATIC
|
||||
#include "third_party/glew/glew.h"
|
||||
#include "third_party/glew/wglew.h"
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(_WIN32)
|
||||
|
||||
// Define the missing format for the etc1
|
||||
#ifndef GL_ETC1_RGB8_OES
|
||||
#define GL_ETC1_RGB8_OES 0x8D64
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
executable("hello_world") {
|
||||
sources = [
|
||||
"hello_world.cc",
|
||||
]
|
||||
sources = [ "hello_world.cc" ]
|
||||
|
||||
deps = [
|
||||
"//src/base",
|
||||
|
|
|
@ -79,7 +79,10 @@ source_set("third_party") {
|
|||
"volk/volk.c",
|
||||
]
|
||||
|
||||
defines = [ "VMA_STATIC_VULKAN_FUNCTIONS=1", "GLEW_STATIC" ]
|
||||
defines = [
|
||||
"VMA_STATIC_VULKAN_FUNCTIONS=1",
|
||||
"GLEW_STATIC",
|
||||
]
|
||||
|
||||
if (target_os == "linux" || target_os == "win") {
|
||||
sources += [
|
||||
|
|
Loading…
Reference in New Issue