diff --git a/__main__.py b/__main__.py index 5b11138..9101599 100644 --- a/__main__.py +++ b/__main__.py @@ -55,7 +55,7 @@ glHint(GL_FOG_HINT, GL_DONT_CARE) glFogi(GL_FOG_MODE, GL_LINEAR) glFogf(GL_FOG_START, CHUNK_SIZE*2) - glFogf(GL_FOG_END, (world.render_distance+2) * CHUNK_SIZE) + glFogf(GL_FOG_END, (world.render_distance - 1) * CHUNK_SIZE) # get window size def get_window_size(): diff --git a/core/fileutils.py b/core/fileutils.py index a06e8fc..52d4659 100644 --- a/core/fileutils.py +++ b/core/fileutils.py @@ -1,7 +1,6 @@ import os import json import threading -import sys class ListenerBase: def __init__(self, directory): diff --git a/core/renderer.py b/core/renderer.py index 2c6a0ba..c6c0fb6 100644 --- a/core/renderer.py +++ b/core/renderer.py @@ -85,8 +85,6 @@ def shared_context(self, window): except Exception as e: pass - glfw.poll_events() - glfw.swap_buffers(window2) glfw.terminate() def create_vbo(self, window): diff --git a/launch.py b/launch.py new file mode 100644 index 0000000..b248a13 --- /dev/null +++ b/launch.py @@ -0,0 +1,23 @@ +import sys +import subprocess +import pkg_resources + +# make sure pip is installed +try: + pkg_resources.require("pip") +except pkg_resources.DistributionNotFound: + print("pip is not installed. Please install pip.") + sys.exit(1) + +required = {'glfw', 'pygame', 'opensimplex', 'psutil', 'pyopengl', 'pyopengl-accelerate', 'numpy', 'pillow'} +installed = {pkg.key for pkg in pkg_resources.working_set} +missing = required - installed + +if missing: + subprocess.Popen([sys.executable, '-m', 'pip', 'install', *missing]).wait() + +# run git pull +subprocess.Popen(['git', 'pull']).wait() + +# run the game +subprocess.Popen(['python', '__main__.py']).wait() diff --git a/terrain/chunk.py b/terrain/chunk.py index 14592dd..1680576 100644 --- a/terrain/chunk.py +++ b/terrain/chunk.py @@ -1,4 +1,6 @@ import subprocess +import sys + from terrain.block import * from core.renderer import *