Skip to main content

No project description provided

Project description

made by : Matthew R and William L

//////////////////////////// -----welcome to skyport----- //////////////////////////// v0.2.1(unstable)

the purpos of skyport is to:

is to be a game engine that automaticly takes care of rendering loop , file pre loading and having a few usful utilaty tools

boilerplate code :

import skyport as sp

dm = sp.Display_Manager(
    window_size=(1920,1080),
    display_size=(960,540),
    window_name="skyport test"
    )

dm.START_RENDERING_THREAD(fps=60)
while dm.running:

    dm.event_handler()

Display_Manager :

the display manager is made to automaticly handle the window on a separete thread so that the rendering loop can be separet from the game loop

Loader :

the loader is made to pre cache files in memory

# how to make a Loader map :
    ```json
    {
        "path":{"value":null,"type":null},
        ...
    }
    ```
    in the Loader_map format there are a couple of types and each do difrent things.
    TYPES:
     - "r" / "replace" : this type will read the file from where "value" sais to rather than the og path. example : ```json "path/jeff.png":{"value":"replacement_path.jpg,"type":"r"} ```
     - "list" : this mode allows you to load an entire file under 1 name by havig "path" as the folder dir and then in "value" you would place a list of files you would like to load. example : ```json "path/dave":{"value":["bob.png","sam/frend.json"...],"type":"list"} ``` how you would acses this is : loader_instance.read(path)[index]
     - "dict" : this type allows you to load an entire folder under one name slightly dif. the "path" would be the folder dir just like in "list" but this time "value" is filled with a dict of {"name":"file"} instead of a list. example ```json "assets/rand":{"value":{"dave":"dave.png","bob":"idk/jeff.csv"},"type":"dict} ``` and how you would acses it is by : loader_instance.read(path)[name]
     - null : this is the defalt and it dose not matter what the "type" is. this mode will load the "path" to the Loader map and how you would acses the file would be : loader_instance.read(path)

    FULL FILE EXAMPLE:
    ```json
    {
        "assets/jeff.png":{
            "value":null,
            "type":null
        },
        "assets/rand/":{
            "value":[
                "ball.json",
                "ball.png"
            ],
        "type":"list"
        },
        "assets/icons": {
            "type": "dict",
            "value": {
                "button1": "button_play.png",
                "coin": "coin.png",
                "button2": "button2.png"
            }
        },
        "assets/files/data.png":{
            "value":"texture_pack/file/data.png",
            "type":"replace"
        }
    }
    ```
# how to use Loader in code :
    the Loader is simple, you first create an instance and pass in __file__ so that the Loader can resolve realative paths then you can pre load the Loader with a Loader map (this is optional) then you can use the Loader to read files whether they have been pre caches or not. example code :
    ```python
    import skyport as sp

    # you need to pass in __file__ so the Loader knows where to do realative paths
    loader = sp.Loader(__file__)
    # (optional) you can pre load all the files you want into the Loader so you dont have to get them later
    loader.load_from_map("loader_map_test1.json")

    # to read the content of the file whether the Loader has pre loaded it or not you can call read()
    file_data = loader.read(path="my_path/image.png",add_to_map=True)
    # this method allows you to create more conviniant names for your pre loaded files
    loader.create_alias("my_path/image.png","image")
    # this returns the dict of supported types and there file handlers
    loader.get_supported_types()
    # you can add your own file types for the loader to support if the loader dose not already suport them 
    loader.add_new_file_handler(".idk",lambda path : open(path,"r"))
    # this is for when u have 1 loaders or 2 name:file maps
    loader.join_maps(map_a=,map_b=)
    # this is for turning any path into an abs path
    loader.resolve_path(path)
    # this is for saving files that are in the Loader
    loader.save(path,map_key) 
    # this is for saving the curent in memory file map
    loader.save_map(path,map)
    # this is for getting the Loader map
    loader.get_map()
    # this is for setting the Loader map
    loader.set_map(map)
    ```
    there are more methods in the loader but they are not mentiond heare

Util :

this is a utilaty class that holds random and potentialy usefull methods sutch as

  • get_angle_and_dist(self,x1:"int",y1:"int",x:"int",y:"int")
  • pryoraty(self,a=None,b=None) : this function will return a if there is an a
  • snap_cords_in_bounds(self,x:"int",y:"int",max_x:"int",max_y:"int",min_x:"int"=0,min_y:"int"=0) : this snaps cords in side of a rect arya
  • couculate_dx_dy(self,dist:"int",angle:"float")
  • couculate_angle_dist(self,dx:"int",dy:"int")
  • play_sound(self,soud_obj:"pygame.mixer.Sound", volume=0.5,loops=0)
  • play_sound_from_point(self,pf,sound_pos:list,listener_pos:list,volume:float=0.5,loops=0,distance_fade=0.5)
  • warp_image(self,image:"pygame.Surface",sizex:"int",sizey:"int",angle:"float")
  • rotate_image(self,image:"pygame.Surface",angle:"float")
  • scale_image(self,image:"pygame.Surface",sizex:"int",sizey:"int")
  • color_swap(self,surface: 'pygame.Surface', old_color: tuple, new_color: tuple) -> 'pygame.Surface' how do use the Util class :
import skyport as sp

util = sp.Util()

a = util.pryoraty(None,2) # a will be 2

print(a)

Delta_timer :

this is for getting the delta time between the curent call of get_dt() and the last one (there is one method -> get_dt())

Camra :

the Camra is a spesial chunk baced map renderer that can efficiently render large 2d maps (more documentation will come later)

Chunk :

this class us used by the Camra class to render large 2d maps (more documentation will come later)

dev_info: email:matthew.le.robins+proj@gmail.com (plz only email if u have found a bug and a good way to fix it and plz ensure i have a way to contact you about you suggested changes or requests)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skyport_engine-0.2.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skyport_engine-0.2.1-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file skyport_engine-0.2.1.tar.gz.

File metadata

  • Download URL: skyport_engine-0.2.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for skyport_engine-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4dc451ad43461afe7731d7d9fed96fe67faabae60a6b7976519c12c29deeb00b
MD5 3d60f2f0d2508249b7512d71888b1c77
BLAKE2b-256 2f4adea2196928e7d603423935bff7b49c8cbbfcee65e5d147b1e72db0eb91d0

See more details on using hashes here.

File details

Details for the file skyport_engine-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: skyport_engine-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for skyport_engine-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91c2c231de7d2870daa9bcdddce449f63aa17e563da58ebf0f28352dd473dc02
MD5 c484ce241eb74b71b15aea4258ec1f24
BLAKE2b-256 7fc568a06b071e653db5f429f2523b9d36df182ab959bf4b9e8dd7887fddbf69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page