VertexEngine-CLI 1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vertex/__init__.py +0 -0
- vertex/__main__.py +68 -0
- vertex/minicli.py +58 -0
- vertex/templates.py +49 -0
- vertexengine_cli-1.0.dist-info/METADATA +138 -0
- vertexengine_cli-1.0.dist-info/RECORD +8 -0
- vertexengine_cli-1.0.dist-info/WHEEL +5 -0
- vertexengine_cli-1.0.dist-info/top_level.txt +1 -0
vertex/__init__.py
ADDED
|
File without changes
|
vertex/__main__.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# __main__.py
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
from PyInstaller.__main__ import run as pyinstaller_run
|
|
6
|
+
|
|
7
|
+
from .minicli import CLI
|
|
8
|
+
from .templates import TEMPLATES
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
cli = CLI()
|
|
13
|
+
|
|
14
|
+
# ------------------
|
|
15
|
+
# build command
|
|
16
|
+
# ------------------
|
|
17
|
+
@cli.command("build")
|
|
18
|
+
def build_executable(
|
|
19
|
+
script_path: str,
|
|
20
|
+
onefile: bool = False,
|
|
21
|
+
windowed: bool = False,
|
|
22
|
+
):
|
|
23
|
+
"""
|
|
24
|
+
Build an executable from a Python script using PyInstaller.
|
|
25
|
+
"""
|
|
26
|
+
if not os.path.isfile(script_path):
|
|
27
|
+
raise FileNotFoundError(f"Script not found: {script_path}")
|
|
28
|
+
|
|
29
|
+
args = ["--clean"]
|
|
30
|
+
|
|
31
|
+
if onefile:
|
|
32
|
+
args.append("--onefile")
|
|
33
|
+
if windowed:
|
|
34
|
+
args.append("--windowed")
|
|
35
|
+
|
|
36
|
+
args.append(script_path)
|
|
37
|
+
|
|
38
|
+
print(f"Running PyInstaller with args: {args}")
|
|
39
|
+
pyinstaller_run(args)
|
|
40
|
+
|
|
41
|
+
# ------------------
|
|
42
|
+
# init command
|
|
43
|
+
# ------------------
|
|
44
|
+
@cli.command("init")
|
|
45
|
+
def init(kind: str = "game"):
|
|
46
|
+
"""Initialize a project template"""
|
|
47
|
+
if kind not in TEMPLATES:
|
|
48
|
+
print("Available templates:", ", ".join(TEMPLATES))
|
|
49
|
+
return
|
|
50
|
+
|
|
51
|
+
for rel_path, content in TEMPLATES[kind].items():
|
|
52
|
+
path = Path.cwd() / rel_path
|
|
53
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
54
|
+
|
|
55
|
+
if path.exists():
|
|
56
|
+
print(f"Skipped existing file: {rel_path}")
|
|
57
|
+
continue
|
|
58
|
+
|
|
59
|
+
path.write_text(content, encoding="utf-8")
|
|
60
|
+
print(f"Created {rel_path}")
|
|
61
|
+
|
|
62
|
+
print(f"Template '{kind}' initialized ✔")
|
|
63
|
+
|
|
64
|
+
cli.run()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
main()
|
vertex/minicli.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# cli.py
|
|
2
|
+
import sys
|
|
3
|
+
import inspect
|
|
4
|
+
from typing import Callable, Dict
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Command:
|
|
8
|
+
def __init__(self, func: Callable, name: str):
|
|
9
|
+
self.func = func
|
|
10
|
+
self.name = name
|
|
11
|
+
self.help = func.__doc__ or ""
|
|
12
|
+
self.signature = inspect.signature(func)
|
|
13
|
+
|
|
14
|
+
def run(self, argv: list[str]):
|
|
15
|
+
params = list(self.signature.parameters.values())
|
|
16
|
+
args = []
|
|
17
|
+
|
|
18
|
+
for i, param in enumerate(params):
|
|
19
|
+
if i < len(argv):
|
|
20
|
+
args.append(argv[i])
|
|
21
|
+
elif param.default is not inspect.Parameter.empty:
|
|
22
|
+
args.append(param.default)
|
|
23
|
+
else:
|
|
24
|
+
raise SystemExit(f"Missing argument: {param.name}")
|
|
25
|
+
|
|
26
|
+
self.func(*args)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CLI:
|
|
30
|
+
def __init__(self):
|
|
31
|
+
self.commands: Dict[str, Command] = {}
|
|
32
|
+
|
|
33
|
+
def command(self, name: str | None = None):
|
|
34
|
+
def decorator(func: Callable):
|
|
35
|
+
cmd_name = name or func.__name__
|
|
36
|
+
self.commands[cmd_name] = Command(func, cmd_name)
|
|
37
|
+
return func
|
|
38
|
+
return decorator
|
|
39
|
+
|
|
40
|
+
def run(self, argv=None):
|
|
41
|
+
argv = argv or sys.argv[1:]
|
|
42
|
+
|
|
43
|
+
if not argv or argv[0] in {"-h", "--help"}:
|
|
44
|
+
self.help()
|
|
45
|
+
return
|
|
46
|
+
|
|
47
|
+
cmd, *args = argv
|
|
48
|
+
if cmd not in self.commands:
|
|
49
|
+
print(f"Unknown command: {cmd}\n")
|
|
50
|
+
self.help()
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
self.commands[cmd].run(args)
|
|
54
|
+
|
|
55
|
+
def help(self):
|
|
56
|
+
print("Available commands:\n")
|
|
57
|
+
for name, cmd in self.commands.items():
|
|
58
|
+
print(f" {name:<12} {cmd.help}")
|
vertex/templates.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# templates.py
|
|
2
|
+
from textwrap import dedent
|
|
3
|
+
|
|
4
|
+
TEMPLATES: dict[str, dict[str, str]] = {
|
|
5
|
+
"game": {
|
|
6
|
+
"main.py": dedent(
|
|
7
|
+
"""\
|
|
8
|
+
from VertexEngine.engine import GameEngine
|
|
9
|
+
from VertexEngine import VertexScreen
|
|
10
|
+
from VertexEngine.scenes import Scene
|
|
11
|
+
import sys
|
|
12
|
+
from PyQt6.QtGui import QIcon
|
|
13
|
+
from PyQt6.QtWidgets import QApplication
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Main(Scene):
|
|
17
|
+
def __init__(self, engine):
|
|
18
|
+
super().__init__(engine)
|
|
19
|
+
self.width = engine.width
|
|
20
|
+
self.height = engine.height
|
|
21
|
+
|
|
22
|
+
def update(self):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
def draw(self, surface):
|
|
26
|
+
VertexScreen.Draw.rect(
|
|
27
|
+
VertexScreen.Draw,
|
|
28
|
+
surface,
|
|
29
|
+
(0, 255, 0),
|
|
30
|
+
(-570, 350, 5000, 500),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if __name__ == "__main__":
|
|
35
|
+
app = QApplication(sys.argv)
|
|
36
|
+
engine = GameEngine(fps=60, width=1920, height=1080)
|
|
37
|
+
engine.setWindowTitle("Template")
|
|
38
|
+
engine.show()
|
|
39
|
+
|
|
40
|
+
main_scene = Main(engine)
|
|
41
|
+
engine.scene_manager.set_scene(main_scene)
|
|
42
|
+
|
|
43
|
+
app.exec()
|
|
44
|
+
"""
|
|
45
|
+
),
|
|
46
|
+
"README.md": "# VertexEngine Game\n\nGenerated with MiniCLI ✨\n",
|
|
47
|
+
".gitignore": "__pycache__/\n.env\n",
|
|
48
|
+
},
|
|
49
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: VertexEngine-CLI
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: An Offical CLI library for VertexEngine.
|
|
5
|
+
Author-email: Tyrel Miguel <annbasilan0828@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://vertexenginedocs.netlify.app/
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: pygame>=2.0
|
|
11
|
+
Requires-Dist: PyQt6>=6.7
|
|
12
|
+
Requires-Dist: pyinstaller>=6.5.0
|
|
13
|
+
Requires-Dist: VertexEngine>=1.0.1
|
|
14
|
+
|
|
15
|
+
# VertexEngine/Vertex
|
|
16
|
+
VertexEngine is a GUI and Game Engine for python applications, it works best if you use py installer
|
|
17
|
+
|
|
18
|
+
## Change Logs (1.0rc1 - 1.1rc4), NEW!
|
|
19
|
+
### 1.1rc4
|
|
20
|
+
- FINAL RC!
|
|
21
|
+
- Added 2 New Libraries:
|
|
22
|
+
~ VertexEngine.WebEngine
|
|
23
|
+
~ VertexEngine.WebView
|
|
24
|
+
### 1.1rc3
|
|
25
|
+
- Revamped Input System!
|
|
26
|
+
- DEMO GAMES!
|
|
27
|
+
- Updated Scene Docs
|
|
28
|
+
### Version 1.1rc2
|
|
29
|
+
- Documentation Expansion!
|
|
30
|
+
~ Fixed the Changelogs
|
|
31
|
+
- New Input System!
|
|
32
|
+
- Old System (Qt) depreceated and not recomended for use.
|
|
33
|
+
### Version 1.1rc1
|
|
34
|
+
- New Library! (And Modules)!:
|
|
35
|
+
~ InputSystem
|
|
36
|
+
~ Buttons (Mouse and Widget)
|
|
37
|
+
~ Keyboard Input
|
|
38
|
+
### Version 1.0.1
|
|
39
|
+
- Added Changelogs!
|
|
40
|
+
### Version 1.0
|
|
41
|
+
- Added 2 New Libraries:
|
|
42
|
+
~ VertexEngine.SimpleGUI
|
|
43
|
+
~ VertexEngine.VertexScreenModifiers
|
|
44
|
+
### Version 1.0rc2
|
|
45
|
+
- Final Release Candidate
|
|
46
|
+
- Added 1 New Library!:
|
|
47
|
+
~ VertexUI
|
|
48
|
+
|
|
49
|
+
### Version 1.0rc1
|
|
50
|
+
- Size Compression
|
|
51
|
+
- Added 1 New Library!:
|
|
52
|
+
~ VertexScreen
|
|
53
|
+
|
|
54
|
+
## How to install Pyinstaller
|
|
55
|
+
Step 1. Type in:
|
|
56
|
+
pip install pyinstaller
|
|
57
|
+
|
|
58
|
+
Step 2. Wait a few min, don't worry if it takes 1 hr or more, it will finish
|
|
59
|
+
|
|
60
|
+
Step 3. How to use pyinstaller
|
|
61
|
+
type:
|
|
62
|
+
python -m PyInstaller --onefile *.py
|
|
63
|
+
|
|
64
|
+
There are flags:
|
|
65
|
+
--noconsole > disables the console when you run the app
|
|
66
|
+
--onefile > compress all of the code into one file
|
|
67
|
+
--icon > the *.ico file after you type it will be set as the app icon.
|
|
68
|
+
|
|
69
|
+
## How to install VertexEngine/Vertex:
|
|
70
|
+
|
|
71
|
+
Step 1:
|
|
72
|
+
Type in
|
|
73
|
+
pip install VertexEngine
|
|
74
|
+
|
|
75
|
+
Step 2: Wait a few min, don't worry if it takes 1 hr or more, it will finish
|
|
76
|
+
|
|
77
|
+
Step 3: Where to start?
|
|
78
|
+
Read the documentations. Also copy the following template:
|
|
79
|
+
-------------------------------------------------------
|
|
80
|
+
from VertexEngine.engine import GameEngine
|
|
81
|
+
from VertexEngine import VertexScreen
|
|
82
|
+
from VertexEngine.audio import AudioManager
|
|
83
|
+
from VertexEngine.scenes import Scene
|
|
84
|
+
import pygame
|
|
85
|
+
import sys
|
|
86
|
+
from PyQt6.QtGui import QIcon
|
|
87
|
+
from PyQt6.QtWidgets import QApplication
|
|
88
|
+
|
|
89
|
+
class Main(Scene):
|
|
90
|
+
def __init__(self, engine):
|
|
91
|
+
super().__init__(engine)
|
|
92
|
+
self.width = engine.width
|
|
93
|
+
self.height = engine.height
|
|
94
|
+
|
|
95
|
+
def update(self):
|
|
96
|
+
pass
|
|
97
|
+
|
|
98
|
+
def draw(self, surface):
|
|
99
|
+
VertexScreen.Draw.rect(VertexScreen.Draw, surface, (0, 255, 0), (-570, 350, 5000, 500))
|
|
100
|
+
|
|
101
|
+
if __name__ == '__main__':
|
|
102
|
+
app = QApplication(sys.argv) # <- create app
|
|
103
|
+
engine = GameEngine(fps=60, width=1920, height=1080, title="Screen.com/totally-not-virus") # <- initialize a1080p window at 60 FPS
|
|
104
|
+
|
|
105
|
+
engine.setWindowTitle('Screen.com/totally-not-virus') # <- name the app
|
|
106
|
+
engine.setWindowIcon(QIcon('snake.ico')) # <- icon
|
|
107
|
+
engine.show() # <- show window
|
|
108
|
+
|
|
109
|
+
main_scene = Main(engine) # <- intialize the scene
|
|
110
|
+
engine.scene_manager.add_scene('main', main_scene) # <- name scene
|
|
111
|
+
engine.scene_manager.switch_to('main') # <- switch to the main scene pls
|
|
112
|
+
|
|
113
|
+
app.exec()
|
|
114
|
+
|
|
115
|
+
The following template creates a window with a green rectangle (the ground.)
|
|
116
|
+
|
|
117
|
+
Pygame or PyQt6 systems are compatible with Vertex so you can use pygame collision system or PyQt6's UI system in VertexEngine.
|
|
118
|
+
|
|
119
|
+
## Help
|
|
120
|
+
The documentation is in the following link:
|
|
121
|
+
[Project Documentation](https://vertexenginedocs.netlify.app/) for help.
|
|
122
|
+
|
|
123
|
+
## Dependencies
|
|
124
|
+
Vertex obviously has heavy dependencies since it's a game engine, the following requirements are:
|
|
125
|
+
|
|
126
|
+
| Dependency | Version |
|
|
127
|
+
|------------------|--------------------------------------|
|
|
128
|
+
| PyQt6 | >=6.7 |
|
|
129
|
+
| Pygame | >=2.0 |
|
|
130
|
+
| Python | >=3.10 |
|
|
131
|
+
|
|
132
|
+
## About Me ❔
|
|
133
|
+
I Am a solo developer in Diliman, Quezon City that makes things for fun :)
|
|
134
|
+
77 Rd 1, 53 Rd 3 Bg-Asa QC
|
|
135
|
+
Email:
|
|
136
|
+
FinalFacility0828@gmail.com
|
|
137
|
+
## 📄 License
|
|
138
|
+
VertexEngine/Vertex is Managed by the MIT License. This license allows others to tweak the code. However, I would like my name be in the credits if you choose this as your starting ground for your next library.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
vertex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
vertex/__main__.py,sha256=E3eoBSHIrM5QSmZKWZQRwjEE7IwNy4dykLZNsu5USfQ,1726
|
|
3
|
+
vertex/minicli.py,sha256=BhpqfYq5eEhwVkAa7I0AycjDmTlQ4q3S0DbSHKxLQgs,1554
|
|
4
|
+
vertex/templates.py,sha256=q4ZLYaieb2GVlgt0t7svo8B8emw_x4Jetca1kprTacI,1532
|
|
5
|
+
vertexengine_cli-1.0.dist-info/METADATA,sha256=g0K7T0VjLcHZPUSWAYKopWhglu98WYK5tCdaYxYwVB4,4526
|
|
6
|
+
vertexengine_cli-1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
7
|
+
vertexengine_cli-1.0.dist-info/top_level.txt,sha256=hUfBmDVpG0gMBhuaAWLQqXDZQkqBdFPWZY7O9NNajVg,7
|
|
8
|
+
vertexengine_cli-1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vertex
|