-------------------------------------------------------------------------------- -- Function......... : createHUD -- Author........... : -- Description...... : -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function FPSCamera.createHUD ( ) -------------------------------------------------------------------------------- local hCenterMouseAction = hud.newAction ( application.getCurrentUser ( ), "HUDCenterMouse" ) if ( hCenterMouseAction ~= nil ) then hud.beginActionCommand ( hCenterMouseAction, hud.kCommandTypeSetCursorPosition ) hud.pushActionCommandArgument ( hCenterMouseAction, 0 ) hud.pushActionCommandArgument ( hCenterMouseAction, 0 ) hud.endActionCommand ( hCenterMouseAction ) end local hShowMouseAction = hud.newAction ( application.getCurrentUser ( ), "HUDShowMouse" ) if ( hShowMouseAction ~= nil ) then hud.beginActionCommand ( hShowMouseAction, hud.kCommandTypeSetCursorVisible ) hud.pushActionCommandArgument ( hShowMouseAction, true ) hud.endActionCommand ( hShowMouseAction ) end local hHideMouseAction = hud.newAction ( application.getCurrentUser ( ), "HUDHideMouse" ) if ( hHideMouseAction ~= nil ) then hud.beginActionCommand ( hHideMouseAction, hud.kCommandTypeSetCursorVisible ) hud.pushActionCommandArgument ( hHideMouseAction, false ) hud.endActionCommand ( hHideMouseAction ) end local hTarget = hud.newComponent ( application.getCurrentUser ( ), hud.kComponentTypeLabel ) if ( hTarget ~= nil ) then hud.setComponentPosition ( hTarget, 50, 50 ) hud.setComponentSize ( hTarget, 6, 8 ) hud.setComponentBorderColor ( hTarget, 127, 127, 127, 0 ) hud.setComponentBackgroundColor ( hTarget, 127, 127, 127, 96 ) hud.setComponentBackgroundImage ( hTarget, "HUDTarget" ) local hShowTargetAction = hud.newAction ( application.getCurrentUser ( ), "HUDShowTarget" ) if ( hShowTargetAction ~= nil ) then hud.beginActionCommand ( hShowTargetAction, hud.kCommandTypeSetVisible ) hud.pushActionCommandArgument ( hShowTargetAction, hTarget ) hud.pushActionCommandArgument ( hShowTargetAction, true ) hud.endActionCommand ( hShowTargetAction ) end local hHideTargetAction = hud.newAction ( application.getCurrentUser ( ), "HUDHideTarget" ) if ( hHideTargetAction ~= nil ) then hud.beginActionCommand ( hHideTargetAction, hud.kCommandTypeSetVisible ) hud.pushActionCommandArgument ( hHideTargetAction, hTarget ) hud.pushActionCommandArgument ( hHideTargetAction, false ) hud.endActionCommand ( hHideTargetAction ) end end -------------------------------------------------------------------------------- end --------------------------------------------------------------------------------