Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
VisualGMQ | 2de5647de5 |
|
@ -28,7 +28,6 @@ target_include_directories(
|
|||
)
|
||||
|
||||
option(USE_GLEW "use glew rather than glad" OFF)
|
||||
option(BUILD_TEST "build unittests" OFF)
|
||||
|
||||
if (USE_GLEW)
|
||||
message(STATUS "use glew to load opengl functions")
|
||||
|
@ -43,7 +42,7 @@ if (USE_GLEW)
|
|||
PUBLIC $<$<BOOL:"${USE_GLEW}">:TINYENGINE_USE_GLEW>
|
||||
)
|
||||
else()
|
||||
message(STATUS "use glad to load opengl functions")
|
||||
message(STATUS "use glad to load opengl functions, this only work on MacOS")
|
||||
target_include_directories(
|
||||
${ENGINE_NAME}
|
||||
PUBLIC libs/glad/include
|
||||
|
@ -107,7 +106,7 @@ add_custom_target(
|
|||
COMMAND ${CMAKE_COMMAND} -E remove_directory output
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory output
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory output/game
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<IF:$<STREQUAL:$<PLATFORM_ID>,"Windows">,./build/${PROJECT_NAME}.exe,./build/${PROJECT_NAME}> output/game/${PROJECT_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ./build/${PROJECT_NAME} output/game/${PROJECT_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ./assets output/game/assets
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ./output/game/assets/test
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ./HowToPlay.md output/
|
||||
|
|
28
ReadMe.md
28
ReadMe.md
|
@ -1,13 +1,18 @@
|
|||
# SpaceWar
|
||||
|
||||
为1MGames游戏开发比赛制作的游戏。采用C++17开发。
|
||||
编译好的参赛作品在[这里](https://gitee.com/VisualGMQ/space-war/releases/v1.0.0)
|
||||
一款空战类游戏。采用C++17开发。
|
||||
|
||||
## 1MGames相关
|
||||
|
||||
1MGames比赛相关代码在`1mgames`分支下。此分支在未来可能会继续开发,目前不稳定。
|
||||
|
||||
## 编译方法
|
||||
|
||||
编译平台为MacOS(在MacOS Big Sur 11.6中编译成功且结果在1M以下),也可以在其他平台编译,但编译结果**不保证在1M以下**,仅仅是为了方便不同平台进行编译。
|
||||
依赖:
|
||||
|
||||
使用CMake 3.20及以上进行编译。需要拉取`glfw`作为子工程:
|
||||
* SDL, SDL\_image, SDL\_ttf
|
||||
|
||||
使用CMake 3.20及以上进行编译。需要拉取`SDLEngine`作为子工程:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
|
@ -20,21 +25,6 @@ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
|||
cmake --build build
|
||||
```
|
||||
|
||||
如果想要使用`glew`,可以通过以下命令(默认用glad):
|
||||
|
||||
```bash
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DUSE_GLEW=ON
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
cmake会在你的电脑上寻找`glew`。
|
||||
|
||||
如果想要压缩文件至1M以下,你需要有`strip`程序和`upx`程序,并执行:
|
||||
|
||||
```bash
|
||||
cmake --build build --target CompressExe
|
||||
```
|
||||
|
||||
编译好后执行pack命令打包
|
||||
|
||||
```bash
|
||||
|
|
|
@ -63,7 +63,7 @@ T Random(const T& low, const T& high) {
|
|||
static_assert(std::is_floating_point<T>::value || std::is_integral<T>::value);
|
||||
|
||||
std::random_device device;
|
||||
if constexpr (std::is_floating_point<T>::value) {
|
||||
if (std::is_floating_point<T>::value) {
|
||||
std::uniform_real_distribution<T> dist(low, high);
|
||||
return dist(device);
|
||||
} else {
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include <utility>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
#include <cstring>
|
||||
|
||||
#include "miniaudio.h"
|
||||
#include "stb_image.h"
|
||||
|
|
Reference in New Issue