Esempio n. 1
0
 def push_event(self, event, data=None):
     """
     EntityScript.push_event
     :param event:
     :param data:
     :return:
     """
     data = data or Table()
     data.state = self.current_state.name
     self.buffered_events.append(Table(name=event, data=data))
Esempio n. 2
0
    def __init__(self):
        super(EntityScript, self).__init__()
        self.tags = set()
        self.brain = None
        self.brainfn = None
        self.sg = None
        self.event_listeners = {}  # 也可以由listen_for_event初始化
        self.event_listening = {}

        self.components = Table()
Esempio n. 3
0
 def __init__(self):
     super(Graphics, self).__init__()
     self.enable_msaa = True
     self.enable_shader = True
     self.enable_text = False
     self.renderable_map = {}
     self.clear_flag = GL_COLOR_BUFFER_BIT
     self.current_matrix_mode = None
     self.enable_depth_test = True
     self.enable_light = False
     self.enable_texture = False
     self.clear_color = (.9, .95, 1.0, 1.0)
     self.near = 0.1
     self.far = 1000.
     self.fov = 60.
     self.projection_mode = 0  # 0 for perspective, 1 for ortho
     self._look_at_args = Table(eye_position=(-25.0, 8.0, 5.0),
                                target_position=(0.0, 5.0, 22.0),
                                up=(0.0, 1.0, 0.0))
Esempio n. 4
0
 def go_to_state(self, state_name, *params):
     """
     /
     :param state_name:
     :param params: Table
     :return:
     """
     assert state_name in self.sg.states, "TRIED TO GO TO INVALID STATE %s" % state_name
     from_state = self.current_state
     from_state and from_state.on_exit and from_state.on_exit(
         self.inst, state_name)
     to_state = self.sg.states[state_name]
     self.tags = set(
         to_state.tags) if to_state.tags else set()  # 拷贝新状态的tags
     self.last_state, self.current_state = self.current_state, to_state
     to_state.on_enter and to_state.on_enter(self.inst, params)
     self.inst.push_event('new_state', Table(state_name=state_name))
     self.state_start_time = now()
     self.timeline_index = 0 if to_state.timeline else None
     SGManager.on_enter_new_state(self)
Esempio n. 5
0
TheConfig = Table(
    Common=Table(
        debug=True,
        engineDir='D:\\MiniProj_01\\ZeloEngineScript',
        lockFPSTo30=True,
        localdataDir='D:\\MiniProj_01\\ZeloEngineScript\\localdata',
    ),
    Window=Table(
        mainWndCaption='ZeloEngine',
        clientWidth=640,
        clientHeight=320,
        fullScreen=False,
    ),
    Render=Table(
        # the projection matrix
        Projection=Table(
            screenFar=1000.,
            screenNear=.1,
            fieldOfView=math.pi / 4.,
        ),
        screenWidth=400,
        screenHeight=300,
        enable4xMsaa=False,
        _4xMsaaQuality=0,
        enableDepthStencilTest=True,
    ),
    Input=Table(
        mouseXSensitivity=1.,
        mouseYSensitivity=1.,
        mouseWheelSensitivity=1.,
        # 游戏命令ID => 输入索引
        # 一一映射
        # 可以通过config重载来加载不同映射表
        input_mapping={'test_game_cmd': 'Key-BTN_BASE3'}),
    Python=Table(sys_path=[
        '', 'C:\\windows\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs',
        'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win',
        'C:\\Python27\\lib\\lib-tk', 'C:\\Python27',
        'C:\\Python27\\lib\\site-packages'
    ]))
Esempio n. 6
0
# coding=utf-8
# zstrings.py
# created on 2020/9/27
# author @zoloypzuo
# usage: zstrings
from common.ztable import Table

STRINGS = Table(HelloWorld='hello world')
Esempio n. 7
0
 def look_at(self, eye_position, target_position, up):
     self._look_at_args = Table(eye_position=eye_position,
                                target_position=target_position,
                                up=up)