NPL UI and Event

/** @page ParaEngine_events ParaEngine Events @author LiXizhi

-- bind the event register example function helloworld.ReBindEventHandlers() NPL.load("(gl)script/ide/event_mapping.lua"); -- register mouse click event handler RegisterEvent("_mclick_helloworld_pick", ";helloworld.OnMouseClick();"); -- register mouse move event handler RegisterEvent("_mmove_helloworld_pick", ";helloworld.OnMouseMove();"); -- register mouse down event handler RegisterEvent("_mdown_helloworld_pick", ";helloworld.OnMouseDown();"); -- register mouse up event handler RegisterEvent("_mup_helloworld_pick", ";helloworld.OnMouseUp();"); -- register key event handler RegisterEvent("_k_helloworld_keydown", ";helloworld.OnKeyDownEvent();"); -- register networking event handler RegisterEvent("_n_helloworld_net", ";helloworld.OnNetworkEvent();"); -- register system event handler RegisterEvent("_s_helloworld_system", ";helloworld.OnSystemEvent();"); end

- name: mouse events - desc: fired when the user clicked the mouse on some controls or 3D scene. - type: mouse - scode: mouse_button="{left|middle|right|}";mouse_x=X;mouse_y=Y;mouse_dx=deltaX;mouse_dy=deltaY;mouse_wheel_delta = {-1|1}; - param X: screen X position - param Y: screen Y position

- name: key events - desc: never fired - type: key - scode: virtual_key = a value in Event_Mapping table.see NPL.load("(gl)script/ide/event_mapping.lua"); - scode:

- name: UI frame move event - desc: fired whenever a UI object is rendered with a elapsed time larger than 0. - type: UI - scode: deltatime = elapsed time in second since last call

- name: editor events - desc: fired when user performs a certain editing function over the scene - scode: event_type = { ED_SELECTION_CHANGED = 0, ED_OBJECT_DELETED, ED_OBJECT_CREATED, ED_OBJECT_MODIFIED, ED_SCENE_LOADED, ED_SCENE_UNLOADED, ED_SCENE_SAVING, ED_SCENE_SAVED, }; - param: more information, please see Editor_events enum in "Events_def.h"

- name: ID_ACCOUNT_LOGIN_ACCEPTED - desc: fired whenever this client has successfully connected to a remote server. - type: network - scode: event_type=107;pkg={username=[name]}; - param [name]: user name

- name: ID_ACCOUNT_LOGIN_DENIED - desc: fired whenever this client has unsuccessfully connected to a remote server. - type: network - scode: event_type=108;

- name: ID_NEW_RECEPTOR_CONNECT - desc: fired whenever this server has successfully accepted a remote client. - type: network - scode: event_type=110;pkg={username=[name]}; - param [name]: user name

- name: ID_RECEPTOR_USER_LOST - desc: fired whenever this client has lost connection with a remote server. - type: network - scode: event_type=111;pkg={username=[name]}; - param [name]: user name

- name: ID_CENTER_USER_LOST - desc: fired whenever this server has lost connection with a remote client. - type: network - scode: event_type=112;pkg={username=[name]}; - param [name]: user name


character actions in ParaEngine.

Title character actions in ParaEngine.
Author(s) Date: 2006/12/5
Date 2006/12/5
File script/ide/action_table.lua


TIP Sample Code


Member Functions


 prefined ActionSymbols
action_table.ActionSymbols = {
   S_STANDING = BeginEnum(),      -- ensure the biped has no speed
   S_IN_WATER = AutoEnum(),         -- make sure that the biped is in water
   S_ON_FEET = AutoEnum(),         -- make sure that the biped is on land and on its feet
   S_ON_WATER_SURFACE = AutoEnum(),         -- make sure that the biped is on land and on its feet
   POP_ACTION = AutoEnum(), -- pop the current action
   S_STAND = AutoEnum(),
   S_WALK_FORWORD = AutoEnum(),
   S_RUN_FORWORD = AutoEnum(),
   S_WALK_LEFT = AutoEnum(),
   S_WALK_RIGHT = AutoEnum(),
   S_WALK_POINT = AutoEnum(),      -- walking to a point
   S_TURNING = AutoEnum(),
   S_WALK_BACKWORD = AutoEnum(),
   S_SWIM_FORWORD = AutoEnum(),
   S_SWIM_LEFT = AutoEnum(),
   S_SWIM_RIGHT = AutoEnum(),
   S_SWIM_BACKWORD = AutoEnum(),
   S_JUMP_START = AutoEnum(),
   S_JUMP_IN_AIR = AutoEnum(),   -- not used.
   S_JUMP_END = AutoEnum(),
   S_MOUNT = AutoEnum(),
   S_FALLDOWN = AutoEnum(),
   S_ATTACK = AutoEnum(),
   S_ATTACK1 = AutoEnum(),
   S_ATTACK2 = AutoEnum(),
   S_DANCE = AutoEnum(),
   S_ACTIONKEY = AutoEnum(),  -- perform the action in the action key, immediately.
   S_NONE= AutoEnum(),

 prefined action key
action_table.ActionKeyID ={
   TOGGLE_TO_WALK = BeginEnum(),
   TOGGLE_TO_RUN = AutoEnum(),
   JUMP = AutoEnum(),
   MOUNT = AutoEnum(), -- mount on the nearest object
   NONE = AutoEnum(),

play a given animation file on character (player). It will only load the animation file once on first call filename: such as "character/Animation/hs/victory.x"


function action_table.PlayAnimationFile(filename, player)




open a file dialog that allows a user to select an animation file to play for the current character please note that the current character model must support external animation and matches the initial bone animation in the animation file.


function action_table.TestExternalAnimation()
Topic revision: r1 - 2008-02-29 - LiXizhi
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback