Skip to content

Commit

Permalink
small but important changes and fixes
Browse files Browse the repository at this point in the history
+ prepare.py
+ build command in CapsianLine

- removed garbage
  • Loading branch information
Alessandro-Salerno committed Mar 6, 2021
1 parent f486b9a commit 48fa5ce
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 283 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ __pycache__/
*$py.class
.vscode
.VSCodeCounter
whiteboard.txt

# C extensions
*.so
Expand Down
8 changes: 6 additions & 2 deletions Capsian/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# ----------------------------------------------------------------------------


from Capsian.world import Clock
from Capsian.world import Clock
import pyglet


Expand All @@ -63,14 +63,18 @@

# Returns a version sting
def version():
return "Capsian Engine v1.0 a1"
return "Capsian Engine v1.0 a2"


# Prepares the application
def run():
from datetime import datetime
import Capsian.services

if not pyglet.version == "1.5.6":
print("CompatibilityError: Your version of Pyglet is not supported. Please run prepare.py to get the right onw!")
return

default_clock.entry_points.call(datetime.now())
pyglet.app.run()
default_clock.exit_points.call(datetime.now())
Expand Down
8 changes: 3 additions & 5 deletions Capsian/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,15 @@
# ----------------------------------------------------------------------------



from datetime import datetime
from Capsian import *
from os import system
from datetime import datetime
from Capsian import *
from os import system
import sys


class TermColor:
"""
Gives colors for the Terminal/Command Prompt
"""

HEADER = '\033[95m'
Expand Down
8 changes: 4 additions & 4 deletions Capsian/services.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from Capsian.input.keyboard import KeyboardInputHandler
from Capsian.entities.components_handler import ComponentsHandler
from pyglet.window import key as Key
import Capsian.engine as engine
from Capsian.input.keyboard import KeyboardInputHandler
from Capsian.entities.components_handler import ComponentsHandler
from pyglet.window import key as Key
import Capsian.engine as engine
import pyglet


Expand Down
8 changes: 4 additions & 4 deletions Capsian/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
# ----------------------------------------------------------------------------


from Capsian.video.sky_color import SkyColorClass
from Capsian.video.scene import Scene, Scene3D, Scene2D, OverlayScene, PlaceholderScene
from Capsian.video.camera import PerspectiveCamera, OrthographicCamera, Camera
from Capsian.components.component import Component
import pyglet
from Capsian.video.sky_color import SkyColorClass
from Capsian.video.scene import Scene, Scene3D, Scene2D, OverlayScene, PlaceholderScene
from Capsian.video.camera import PerspectiveCamera, OrthographicCamera, Camera
from Capsian.components.component import Component


CPSN_DEFAULT_DELTA_TIME = 1/120
Expand Down
21 changes: 19 additions & 2 deletions CapsianLine/commands/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,33 @@ def commands(self):

def run(self):
import os
os.system("start Python\Windows\pythonw.exe -u main.py")
os.system("pythonw main.py")


def debug(self):
import os
os.system("Python\Windows\python.exe -u main.py")
os.system("python main.py")


def reload(self):
from CapsianLine.commands import system
import CapsianLine.design as design
system.clear()
design.draw()


def build(self, onefile=True, windowed=True, icon=None):
import os
command: str = "pyinstaller "

if windowed:
command += "-w "

if onefile:
command += "--onefile "

if icon is not None:
command += f"--icon={icon} "

command += "main.py"
os.system(command)
58 changes: 10 additions & 48 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,13 @@
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# Copyright (c) 2008-2020 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of pyglet nor the names of its
# contributors may be used to endorse or promote products
# derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------------
Copyright 2020 - 2021 Alessandro Salerno (Tzyvoski)

# ----------------------------------------------------------------------------
# Capsian Engine
# Copyright 2020 - 2021 Alessandro Salerno (Tzyvoski)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<p>The latest version of Capsian brings with it numerous improvements to performance. Previous versions struggled to handle over 500 non-batched objects in a scene. This version, though, with the new clock and ticking mechanics, pushes performance to the sky: with an average of 2000 FPS at 5120x2880 and 4700FPS at 1280x720. You can read the code in files "Capsian/video/scene.py" , "Capsian/video/window.py" and "Capsian/world/clock.py" to find out what makes it so performant.
<br>
</p>
<i><strong>ALL TESTS WERE CONDUCTED ON A GTX 1080 AND INTEL CORE i7 8700K 3.70GHz</strong></i>
<i><strong>ALL TESTS WERE CONDUCTED ON A GTX 1080 AND INTEL CORE i7 8700K 3.70GHz (Windows 10)</strong></i>
<br>
<br>
<div align="center">
Expand All @@ -51,6 +51,7 @@
- [Python](https://www.python.org/)
- [OpenGL](https://www.opengl.org/)
- [Pyglet](http://pyglet.org/)
- [Pyinstaller](https://www.pyinstaller.org/)

### Languages

Expand All @@ -70,9 +71,12 @@ To get a local copy up and running follow these simple steps.
- Python 3.7.3 (Or higher)
- Pyglet 1.5.6
- PyOpenGL
- Pyinstaller
- A Code Editor/IDE that supports Python (Like VS Code)

The Linux version will probably be available in March 2021 thanks to a contributor and friend [ [Gyro](https://github.com/Gyro7/) ].
To get the libs, just run the `prepare.py` file.
To build an executable, just run the `line build` command in CapsianLine (`console.py`) and wait.
It should be able to build for any desktop platform given that you're running on such platform.
<br>
</p>

Expand Down
Binary file removed assets/textures/glass.png
Binary file not shown.
2 changes: 1 addition & 1 deletion options.cpsn
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"fog color" : CPSN_DEFAULT_FOG_COLOR,
"fog start" : CPSN_DEFAULT_FOG_START,
"fog end" : CPSN_DEFAULT_FOG_END,
"clear color" : [0, 0, 0, 0],
"clear color" : [0, 0, 0, 0]
}
12 changes: 12 additions & 0 deletions prepare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from os import system


print("Starting Capsian Preparation Tool...")
print("This script will install all the dependencies you need")
input("Press enter to continue or lcose to terminate ")

system("pip install pyglet==1.5.6")
system("pip install PyOpenGL")
system("pip install pyinstaller")

input("Installation completed!\nPress enter to exit ")
7 changes: 1 addition & 6 deletions scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
# Here you should list all the scripts you want the engine to load
# This is a substitute to the old option in the options.cpsn file
# EXAMPLE: from scripts.scriptname import *


from scripts.altar import *
# Import all your scripts from here
Loading

0 comments on commit 48fa5ce

Please sign in to comment.