Compare commits
7 Commits
3a9a32d7e3
...
v0.1
Author | SHA1 | Date | |
---|---|---|---|
f4c3ef9b19 | |||
bb4601c5bd | |||
45aa6ba4bc | |||
c3f6ae0ae9 | |||
21c864da60 | |||
a2fed8e4b0 | |||
1196ebd228 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
main.o
|
main.o
|
||||||
easysock.o
|
easysock.o
|
||||||
pong
|
pong
|
||||||
|
release/
|
||||||
|
@@ -13,7 +13,12 @@ This application uses [Meson](https://mesonbuild.com/) as a build system. To bui
|
|||||||
2. Install __raylib__ from the link above (THIS IS OPTIONAL, SEE STEP 5)
|
2. Install __raylib__ from the link above (THIS IS OPTIONAL, SEE STEP 5)
|
||||||
3. Set up the build directory with the `meson setup build` command.
|
3. Set up the build directory with the `meson setup build` command.
|
||||||
4. Compile the application, with the existing raylib installation, using `meson compile -C build`.
|
4. Compile the application, with the existing raylib installation, using `meson compile -C build`.
|
||||||
5. If you don't have raylib installed, you can create a statically linked version of the library on Linux, using `meson compile -C build -Ddefault_library=static`.
|
5. If you don't have raylib installed, you can create a statically linked version of the library on Linux by running the following commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
meson configure -Ddefault_library=static build/
|
||||||
|
meson compile -C build -Ddefault_library=static
|
||||||
|
```
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
|
21
create_release_build.sh
Normal file
21
create_release_build.sh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script copies required DLLs, and the application itself into a folder called 'release'. It only runs on MinGW.
|
||||||
|
|
||||||
|
BASE_DIR=$(dirname $0)
|
||||||
|
REL_DIR="$BASE_DIR/release/dist"
|
||||||
|
|
||||||
|
mkdir -p "$REL_DIR"
|
||||||
|
|
||||||
|
# Parse the output of the 'ldd' command, and create a file with the required DLL paths.
|
||||||
|
ldd build/pong.exe | awk ' NF == 4 {print $3}' > "$BASE_DIR/tmp_file.txt"
|
||||||
|
|
||||||
|
# Copy the required DLLs.
|
||||||
|
cp $(cat "$BASE_DIR/tmp_file.txt") "$REL_DIR"
|
||||||
|
|
||||||
|
# Copy the executable itself
|
||||||
|
cp "$BASE_DIR/build/pong" "$REL_DIR"
|
||||||
|
|
||||||
|
# Remove the temporary file.
|
||||||
|
rm "$BASE_DIR/tmp_file.txt"
|
||||||
|
|
2
main.cpp
2
main.cpp
@@ -211,7 +211,7 @@ int main(int argc, char** argv) {
|
|||||||
SetTraceLogLevel(LOG_NONE);
|
SetTraceLogLevel(LOG_NONE);
|
||||||
raylib::Window window = raylib::Window(WIDTH, HEIGHT, "Pong");
|
raylib::Window window = raylib::Window(WIDTH, HEIGHT, "Pong");
|
||||||
window.ClearBackground(BLACK);
|
window.ClearBackground(BLACK);
|
||||||
SetTargetFPS(10);
|
SetTargetFPS(60);
|
||||||
SetExitKey(KEY_Q);
|
SetExitKey(KEY_Q);
|
||||||
std::string points_str = std::string("0\t\t0");
|
std::string points_str = std::string("0\t\t0");
|
||||||
bool game_started = false;
|
bool game_started = false;
|
||||||
|
11
meson.build
11
meson.build
@@ -1,4 +1,4 @@
|
|||||||
project('Pong', ['cpp', 'c'])
|
project('Pong', ['cpp', 'c'], version: '0.1')
|
||||||
add_global_arguments('-g', '-Wall', '-pedantic', '-Wno-unused-function', language : ['cpp', 'c'])
|
add_global_arguments('-g', '-Wall', '-pedantic', '-Wno-unused-function', language : ['cpp', 'c'])
|
||||||
compiler = meson.get_compiler('cpp')
|
compiler = meson.get_compiler('cpp')
|
||||||
cmake = import('cmake')
|
cmake = import('cmake')
|
||||||
@@ -22,10 +22,15 @@ if get_option('default_library') == 'static'
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
#For Windows only
|
#For Windows only
|
||||||
ws2_dep = compiler.find_library('ws2_32', required: false)
|
ws2_dep = compiler.find_library('ws2_32', required: false)
|
||||||
|
winmm = compiler.find_library('winmm', required: false)
|
||||||
|
if build_machine.system() == 'windows'
|
||||||
|
add_global_arguments('-Wl,--subsystem,windows', '-mwindows', language: ['cpp', 'c']) # Prevent opening console when game is run
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
executable('pong',
|
executable('pong',
|
||||||
'main.cpp', 'easysock.cpp', 'sock.cpp','paddle.cpp', 'ball.cpp', 'numeric_base.cpp', 'connect_code.cpp', 'server.cpp', 'client.cpp',
|
'main.cpp', 'easysock.cpp', 'sock.cpp','paddle.cpp', 'ball.cpp', 'numeric_base.cpp', 'connect_code.cpp', 'server.cpp', 'client.cpp',
|
||||||
'serialization.c',
|
'serialization.c',
|
||||||
dependencies: [raylib, ws2_dep]
|
dependencies: [raylib, ws2_dep, winmm]
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user