Skip to content

Commit

Permalink
fix template4(roguelike) to match new bundle format
Browse files Browse the repository at this point in the history
  • Loading branch information
wkta committed Sep 17, 2024
1 parent 6d62db1 commit 339a04e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 27 deletions.
49 changes: 27 additions & 22 deletions src/pyvcmdline/json_prec.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
{
"vmlib_ver":"void",
"dependencies":{
"pyved_engine": ["24_9a1","pyv"]
},
"description":"this is a placeholder so you can describe your game",
"author":"placeholder_author",
Expand All @@ -34,7 +33,6 @@
{
"vmlib_ver":"void",
"dependencies":{
"pyved_engine": ["24_9a1","pyv"]
},
"description": "this is an example of platformer",
"author": "KataGames_Team",
Expand Down Expand Up @@ -62,7 +60,6 @@
{
"vmlib_ver":"void",
"dependencies":{
"pyved_engine": ["24_9a1","pyv"]
},
"description": "this is a placeholder so you can describe your game",
"author": "moonbak et al.",
Expand Down Expand Up @@ -105,30 +102,38 @@
{
"vmlib_ver":"void",
"dependencies":{
"pyved_engine": ["24_9a1","pyv"]
},
"description": "a basic demo for a roguelike game",
"author": "moonbak",
"asset_base_folder":".",
"sound_base_folder":".",
"asset_list": [
"description": "a basic demo for a roguelike game",
"author": "thomas",
"asset_base_folder": ".",
"sound_base_folder": ".",
"asset_list": [
"smallninja_sprites.json",
"tileset.png",
"monster.png",
"avatar1.png"
],
"sound_list": [],
"slug": "roguelikeDemo",
"title": "Roguelike Template",
"build_date": "Tue Apr 2 15:40:11 2024",
"thumbnail512x384": "thumb_2.png",
"thumbnail512x512": "thumb_1.png",
"ktg_services": false,
"instructions": "no instructions provided",
"uses_challenge": false,
"has_game_server": false,
"ncr_faucet": false,
"game_genre": ["Roguelike"]
],
"sound_list": [],
"slug": "JeuEvolue",
"title": "Roguelike Template",
"build_date": "Tue Sep 17 09:06:21 2024",
"thumbnail512x384": "thumb_2.png",
"thumbnail512x512": "thumb_1.png",
"ktg_services": false,
"instructions": "no instructions provided",
"uses_challenge": false,
"has_game_server": false,
"ncr_faucet": false,
"game_genre": [
"Roguelike"
],
"game_title": "JeuEvolue",
"source_files": [
"gamedef.py",
"glvars.py",
"mvc_parts.py",
"__init__.py"
]
}
"""

Expand Down
3 changes: 1 addition & 2 deletions src/pyvcmdline/template_4/cartridge/gamedef.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from . import pimodules
from .mvc_parts import NinjamazeMod, NinjamazeView, NinjamazeCtrl, SpecificEvTypes
from . import glvars
from .glvars import pyv


pyv = pimodules.pyved_engine
EngineEvTypes = pyv.EngineEvTypes


Expand Down
24 changes: 24 additions & 0 deletions src/pyvcmdline/template_4/cartridge/glvars.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# ------
# engine-related code, do not modify!
# --------

registry = set()
libname_to_alias_mapping = dict()

def get_alias(origin_lib_name):
return libname_to_alias_mapping[origin_lib_name]

def has_registered(origin_lib_name):
return origin_lib_name in libname_to_alias_mapping

def register_lib(alias, libname, value): # handy for dependency injection
global registry, libname_to_alias_mapping
libname_to_alias_mapping[libname] = alias
if alias in registry:
raise KeyError(f'Cannot register lib "{alias}" more than once!')
globals()[alias] = value
registry.add(alias)


# ------
# custom code the gamedev added
# --------

avatar_sprite_sheet = None
6 changes: 3 additions & 3 deletions src/pyvcmdline/template_4/cartridge/mvc_parts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
this file contains 3 basic mvc COMPOnents
that can implement a rogue-like
"""
from . import pimodules
from . import glvars
pyv = pimodules.pyved_engine
pyv.bootstrap_e()
from .glvars import pyv


pyv.bootstrap_e()

pygame = pyv.pygame
EngineEvTypes = pyv.EngineEvTypes
Expand Down

0 comments on commit 339a04e

Please sign in to comment.