Rework player movement in C++

This commit is contained in:
Layla 2021-03-06 00:27:07 -05:00
parent 3dd00eabd3
commit a21e90388e
110 changed files with 570 additions and 162 deletions

22
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/cpp/.devcontainer/base.Dockerfile
# [Choice] Debian / Ubuntu version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="buster"
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends build-essential scons pkg-config libx11-dev libxcursor-dev libxinerama-dev \
libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm mingw-w64
ARG GODOT_VERSION="3.2.3"
RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \
&& wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_export_templates.tpz \
&& mkdir ~/.cache \
&& mkdir -p ~/.config/godot \
&& mkdir -p ~/.local/share/godot/templates/${GODOT_VERSION}.stable \
&& unzip Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \
&& mv Godot_v${GODOT_VERSION}-stable_linux_headless.64 /usr/local/bin/godot \
&& unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz \
&& mv templates/* ~/.local/share/godot/templates/${GODOT_VERSION}.stable \
&& rm -f Godot_v${GODOT_VERSION}-stable_export_templates.tpz Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip

View File

@ -0,0 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/cpp
{
"name": "C++",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04
"args": { "VARIANT": "ubuntu-20.04", "GODOT_VERSION" : "3.2.3" }
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "gcc -v",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}

50
.gitignore vendored Normal file
View File

@ -0,0 +1,50 @@
# Godot
client/.import/
client/export.cfg
client/export_presets.cfg
api.json
logs/
*.translation
# Godot Mono
client/.mono/
client/data_*/
# Scons
.sconsign.dblite
# Object script
*.os
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app

5
.gitmodules vendored
View File

@ -3,4 +3,7 @@
url = git@github.com:CptPotato/GodotThings.git
[submodule "client/Assets/Proprietary"]
path = client/Assets/Proprietary
url = git@github.com:josephbmanley/the-connection-proprietary.git
url = git@github.com:josephbmanley/the-connection-proprietary.git
[submodule "godot-cpp"]
path = godot-cpp
url = git@github.com:godotengine/godot-cpp.git

37
Makefile Normal file
View File

@ -0,0 +1,37 @@
PROJECTNAME="The Connection"
platform=linux
threads=4
build-godot-bindings:
@echo " > Generating `api.json`..."
@godot --gdnative-generate-json-api api.json
@echo " > Building bindings..."
@cd godot-cpp && scons platform=$(platform) bits=64 generate_bindings=yes -j$(threads) use_custom_api_file=yes custom_api_file=../api.json
## compile: Compiles GDNative code
compile:
@mkdir -p ./godot/bin
@echo " > Compiling GDNative..."
@scons platform=$(platform)
## build: Cleans project, create bindings, and compiles GDNative
build: clean build-godot-bindings compile
## clean: Removes all build related files
clean:
@echo " > Cleaning project..."
@rm -f ./api.json
@rm -f ./.sconsign.dblite
@rm -rf ./godot-cpp/bin
@find ./client/bin -name \*.dll -type f -delete
@find ./client/bin -name \*.so -type f -delete
@find ./client/bin -name \*.dylib -type f -delete
## help: Displays help text for make commands
.DEFAULT_GOAL := help
all: help
help: Makefile
@echo " Choose a command run in "$(PROJECTNAME)":"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'

156
SConstruct Normal file
View File

@ -0,0 +1,156 @@
#!python
import os, sys
opts = Variables([], ARGUMENTS)
# Gets the standard flags CC, CCX, etc.
env = DefaultEnvironment()
# Define our options
opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release']))
opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'client/bin/'))
opts.Add(PathVariable('target_name', 'The library name.', 'connection', PathVariable.PathAccept))
# Local dependency paths, adapt them to your setup
godot_headers_path = "godot-cpp/godot-headers/"
cpp_bindings_path = "godot-cpp/"
cpp_library = "libgodot-cpp"
# only support 64 at this time..
bits = 64
# Updates the environment with the option variables.
opts.Update(env)
# Process some arguments
if env['use_llvm']:
env['CC'] = 'clang'
env['CXX'] = 'clang++'
if env['p'] != '':
env['platform'] = env['p']
if env['platform'] == '':
print("No valid target platform selected.")
quit();
# Try to detect the host platform automatically.
# This is used if no `platform` argument is passed
if sys.platform.startswith('linux'):
host_platform = 'linux'
elif sys.platform == 'darwin':
host_platform = 'osx'
elif sys.platform == 'win32' or sys.platform == 'msys':
host_platform = 'windows'
else:
raise ValueError(
'Could not detect platform automatically, please specify with '
'platform=<platform>'
)
#############
## Mac OSX ##
#############
# Check our platform specifics
if env['platform'] == "osx":
# Throw error if not running on Mac
if host_platform != "osx":
raise "Cross compile not supported for OSX!"
env['target_path'] += 'osx/'
cpp_library += '.osx'
env['target_suffix'] = "dylib"
env.Append(CCFLAGS=['-arch', 'x86_64'])
env.Append(CXXFLAGS=['-std=c++17'])
env.Append(LINKFLAGS=['-arch', 'x86_64'])
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS=['-g', '-O2'])
else:
env.Append(CCFLAGS=['-g', '-O3'])
###########
## Linux ##
###########
elif env['platform'] in ('x11', 'linux'):
env['target_path'] += 'x11/'
env['target_suffix'] = "so"
cpp_library += '.linux'
env.Append(CCFLAGS=['-fPIC'])
env.Append(CXXFLAGS=['-std=c++17'])
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS=['-g3', '-Og'])
else:
env.Append(CCFLAGS=['-g', '-O3'])
#############
## Windows ##
#############
elif env['platform'] == "windows":
env['target_path'] += 'win64/'
cpp_library += '.windows'
env['target_suffix'] = "dll"
# Configure compiler for visual studio if bulding windows on windows
if host_platform == 'windows' and not env['use_mingw']:
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
env.Append(ENV=os.environ)
env.Append(CPPDEFINES=['WIN32', '_WIN32', '_WINDOWS', '_CRT_SECURE_NO_WARNINGS'])
env.Append(CCFLAGS=['-W3', '-GR'])
if env['target'] in ('debug', 'd'):
env.Append(CPPDEFINES=['_DEBUG'])
env.Append(CCFLAGS=['-EHsc', '-MDd', '-ZI'])
env.Append(LINKFLAGS=['-DEBUG'])
else:
env.Append(CPPDEFINES=['NDEBUG'])
env.Append(CCFLAGS=['-O2', '-EHsc', '-MD'])
# Configure compiler for mingw if building for windows on another OS
elif host_platform == 'linux' or host_platform == 'osx':
# MinGW
if bits == 64:
env['CXX'] = 'x86_64-w64-mingw32-g++'
env['AR'] = "x86_64-w64-mingw32-ar"
env['RANLIB'] = "x86_64-w64-mingw32-ranlib"
env['LINK'] = "x86_64-w64-mingw32-g++"
elif bits == 32:
env['CXX'] = 'i686-w64-mingw32-g++'
env['AR'] = "i686-w64-mingw32-ar"
env['RANLIB'] = "i686-w64-mingw32-ranlib"
env['LINK'] = "i686-w64-mingw32-g++"
env.Append(CCFLAGS=['-O3', '-std=c++14', '-Wwrite-strings'])
env.Append(LINKFLAGS=[
'--static',
'-Wl,--no-undefined',
'-static-libgcc',
'-static-libstdc++',
])
if env['target'] in ('debug', 'd'):
cpp_library += '.debug'
else:
cpp_library += '.release'
cpp_library += '.' + str(bits)
# Add paths to libraries and dependencies
env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
env.Append(LIBPATH=[cpp_bindings_path + 'bin/'])
env.Append(LIBS=[cpp_library])
# Add project files
env.Append(CPPPATH=['src/'])
sources = Glob('src/*.cpp')
library = env.SharedLibrary(target=env['target_path'] + env['target_name'] + "." + env['target_suffix'], source=sources)
Default(library)
# Generates help for the -h scons option.
Help(opts.GenerateHelpText(env))

View File

@ -1,3 +0,0 @@
source_md5="9f3599f4ed5f050bd5c7966b39434aeb"
dest_md5="d8b8d051422c7cd9a641096cbf8c2f89"

View File

@ -1,3 +0,0 @@
source_md5="e8dabe73b13a84d293485b937c80f448"
dest_md5="4d425793877e102c4abd32ff8888a949"

View File

@ -1,3 +0,0 @@
source_md5="3bfdad86a3348e10ad92dce7a0c7edfb"
dest_md5="b2215c68eec5e82ae3b199c3ebef6ca3"

View File

@ -1,3 +0,0 @@
source_md5="0f187f924d66394184e7b3e6c957fb8c"
dest_md5="c9bfe92d419f5078052bb89139a81b80"

View File

@ -1,3 +0,0 @@
source_md5="424bc2e8a11a2373217678abda0df97e"
dest_md5="917df80dfa039af088b63b9a234e0ced"

View File

@ -1,3 +0,0 @@
source_md5="8aef6de8412026e94480cc71d8d055b6"
dest_md5="f536ce724bbfd6d3eec9c9b681d8bd87"

View File

@ -1,3 +0,0 @@
source_md5="9d92358506b2f630f49d7186a984dda0"
dest_md5="4d5bf56017f00adbc80e9bf5a14a9f50"

View File

@ -1,3 +0,0 @@
source_md5="08fdfe746696263d9157f46fbf6bcae3"
dest_md5="663720fe7a6ed76fff5d90489304ad6b"

View File

@ -1,3 +0,0 @@
source_md5="e857b8bb76d4617adc95c76a5fb540c2"
dest_md5="27ac0f89acdd7606843ba589e23aa7f4"

View File

@ -1,3 +0,0 @@
source_md5="385e8652393bf9a3fa82a062489c5435"
dest_md5="2ca28503838f7dd03b796000ec31111f"

View File

@ -1,3 +0,0 @@
source_md5="34e50c915b51252660db4c26d6f61d92"
dest_md5="284c8f30177baaab7a71e88c2fa18e87"

View File

@ -1,3 +0,0 @@
source_md5="9f8274a56b9edd5fe16c5dcae157c341"
dest_md5="723b7c3af22143822b4ea69f4a5e464d"

View File

@ -1,3 +0,0 @@
source_md5="a2e5738b2c3c72b7747d4619c999f663"
dest_md5="52ebec391e52938a37545ccc6f79cf74"

View File

@ -1,3 +0,0 @@
source_md5="66ca8a87ea50ca711ae82b664f60a2a4"
dest_md5="369b1a9c914d86a94dc9b0795e76649f"

View File

@ -1,3 +0,0 @@
source_md5="130412d800df4b7c2fc9747a6a5805ef"
dest_md5="94ec308054667a107722b55e2203ebfc"

View File

@ -1,3 +0,0 @@
source_md5="130412d800df4b7c2fc9747a6a5805ef"
dest_md5="94ec308054667a107722b55e2203ebfc"

View File

@ -1,3 +0,0 @@
source_md5="b5b713d18d62a88eb579db8fdc12c626"
dest_md5="3fa5aa738a28dc6cdeb9786d5398a721"

View File

@ -1,3 +0,0 @@
source_md5="7dca0d73f2612d088326ffc420d70d33"
dest_md5="4441e90ddb4675a44bc124eeb8d327f5"

View File

@ -1,3 +0,0 @@
source_md5="1c8d163e355ca2143cf1ee7539743095"
dest_md5="f4d70988d33daba683613005dd05abe5"

View File

@ -1,3 +1,3 @@
source_md5="597fbe9ccf6ea4d6483499e0cf0b03d0"
dest_md5="44096b06df43545f31758f2c690ba4dd"
dest_md5="4855047dc51267405dc34ccef9c9fb32"

View File

@ -1,3 +0,0 @@
source_md5="597fbe9ccf6ea4d6483499e0cf0b03d0"
dest_md5="44096b06df43545f31758f2c690ba4dd"

View File

@ -1,3 +0,0 @@
source_md5="3be96f8f0b1f368b29579f8fe6c79e53"
dest_md5="fb332b986c94f47353bb21064d61380b"

View File

@ -1,3 +0,0 @@
source_md5="3cf9c5ebe05a91b72f0aebb0ee407a93"
dest_md5="8bd975df2444464ff6174d81fef37888"

View File

@ -1,3 +0,0 @@
source_md5="46a58c40f5b6b62c3a59601b0fb55288"
dest_md5="6c83115f14a9c0acf967eb87bf07fe4b"

View File

@ -1,3 +0,0 @@
source_md5="adff44dac2834f17108b17f4084591a1"
dest_md5="e2e7037a5692f3fe173da14e5c60805a"

View File

@ -1,3 +0,0 @@
source_md5="9161b62a08022547a51cb144c79b83c2"
dest_md5="f5e5412b84c441a6c7bf7f80491ac049"

View File

@ -1,3 +0,0 @@
source_md5="53be14e4ad2f67df62927ebe16450b07"
dest_md5="6d3a87776838f14ee876321be0a815b3"

View File

@ -1,3 +0,0 @@
source_md5="d11fe17c538278732c370ff9a9299c13"
dest_md5="518d32294d74c6b89d656e11ba60fff3"

View File

@ -1,3 +0,0 @@
source_md5="4a4e86688ea9e233c2a97d2091f91210"
dest_md5="0b5f4549065c5a8e08ef3984540c93ea"

View File

@ -1,3 +0,0 @@
source_md5="41d8c79b5c539a2acf771607432eee6f"
dest_md5="317679fa87bca09ebef857482e26c6fb"

View File

@ -1,3 +0,0 @@
source_md5="303f11d3124d1c4e7f84eab94f2eec4e"
dest_md5="c435ad0f5644e639bccd3d8ca358885b"

View File

@ -1,3 +0,0 @@
source_md5="46923f78324d6e9a8e0e4a863d2d42b1"
dest_md5="c9e1f79e69e3f2f812c0be531478bb8e"

View File

@ -1,3 +0,0 @@
source_md5="62170d933feb1791d33e1fc234209ff0"
dest_md5="841cfe9c8cca9b353975fdeca4a6818d"

View File

@ -1,3 +0,0 @@
source_md5="ae3bdb1e531d0d500f6d21de544b2067"
dest_md5="8182b7555a30f5839165eafcca9acd9e"

View File

@ -1,3 +0,0 @@
source_md5="dd34a61f0c64a8b28fbc90958cefa569"
dest_md5="5d38a4263fce6ada9174911d6983e089"

View File

@ -1,3 +0,0 @@
source_md5="1fc89dcdb28dde7f2c550bc7fb764a9a"
dest_md5="43cd0d2da5e6d2246e38223d967eaef9"

View File

@ -1,3 +0,0 @@
source_md5="c1837fe565271833906e8389e7ce7c1c"
dest_md5="3d42ff45cbeda89803fb79710d4f5f99"

View File

@ -1,3 +0,0 @@
source_md5="385e8652393bf9a3fa82a062489c5435"
dest_md5="2ca28503838f7dd03b796000ec31111f"

View File

@ -1,3 +0,0 @@
source_md5="385e8652393bf9a3fa82a062489c5435"
dest_md5="2ca28503838f7dd03b796000ec31111f"

View File

@ -1,3 +0,0 @@
source_md5="b85c7252c4e8b281547c84fdfeaec78d"
dest_md5="ec0b5aba05be1d14ab11983117a481f1"

View File

@ -1,3 +0,0 @@
source_md5="6c5effbee182861293c67eb96f5fb23e"
dest_md5="9a076a710fba7054180bf80ce4546229"

View File

@ -1,3 +0,0 @@
source_md5="e2da7fb14b8d464f2eaa56db492be5df"
dest_md5="9b1d426abdf28a2ad8eba161f0c4bb57"

View File

@ -1,3 +0,0 @@
source_md5="c4e868a40fcea38649d43a73971cf969"
dest_md5="d21853d8744e43202ee3050f2c706feb"

View File

@ -1,3 +0,0 @@
source_md5="a44cdfde3fe6df51cb14453b6f8b1544"
dest_md5="a9ee1a40eb796495a96862aa22a8c4c9"

View File

@ -1,3 +1,3 @@
source_md5="88515d8ae34cca55294e20310b7476c4"
dest_md5="0f70ef32cfa3623874dce680b21fdd79"
dest_md5="a03cb2a5b382f6cb692178ac73231566"

View File

@ -3,7 +3,7 @@
[ext_resource path="res://Assets/Materials/SmoothScaling.tres" type="Material" id=1]
[ext_resource path="res://Assets/Art/Characters/player_parts.png" type="Texture" id=2]
[ext_resource path="res://Assets/Art/basic_light.png" type="Texture" id=3]
[ext_resource path="res://Scripts/Entities/Player.gd" type="Script" id=4]
[ext_resource path="res://bin/Player.gdns" type="Script" id=4]
[ext_resource path="res://Assets/Art/flashlight_map.png" type="Texture" id=5]
[ext_resource path="res://Assets/Art/Objects/flashlight.png" type="Texture" id=6]
[ext_resource path="res://Scripts/Entities/Flashlight.gd" type="Script" id=7]

Binary file not shown.

Binary file not shown.

Binary file not shown.

8
client/bin/Player.gdns Normal file
View File

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://bin/connection.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "player"
class_name = "Player"
library = ExtResource( 1 )

Some files were not shown because too many files have changed in this diff Show More