Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ColorPickButtonElement
- ConstructionScreen
- ContextActionDisplay
- ControlBarDisplay
- DialogElement
- DynamicFadedBitmapElement
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GameInfoDisplayMobile
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiTopDownCursor
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDSliderElement
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InfoDisplay
- InfoHUDBox
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputGlyphElementUI
- InputHelpDisplay
- KeyValueInfoHUDBox
- ListElement
- ListItemElement
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PictureElement
- PlatformIconElement
- PlayerControlPadDisplay
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- ScrollingLayoutElement
- SettingsModel
- SideNotification
- SideNotificationMobile
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- SpeedSliderDisplay
- StatusBar
- SteeringSliderDisplay
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TerrainLayerElement
- TextBackdropElement
- TextElement
- TextInputElement
- ThreePartBitmapElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VariableWorkWidthHUDExten...
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- WardrobeScreen
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
GuiTopDownCursor
DescriptionTop-down cursorFunctions
activate
DescriptionActivate the cursor. This will show the cursor and take some input.Definition
activate()Code
126 | function GuiTopDownCursor:activate() |
127 | self.isActive = true |
128 | self:onInputModeChanged({self.inputManager:getLastInputMode()}) |
129 | |
130 | if not self.shapesLoaded then |
131 | self:loadShapes() |
132 | end |
133 | |
134 | setVisibility(self.rootNode, self.isVisible) |
135 | |
136 | self:registerActionEvents() |
137 | self.messageCenter:subscribe(MessageType.INPUT_MODE_CHANGED, self.onInputModeChanged, self) |
138 | end |
deactivate
DescriptionDeactivate the cursor. This will hide the cursor and stop any grabbing of input.Definition
deactivate()Code
142 | function GuiTopDownCursor:deactivate() |
143 | setVisibility(self.rootNode, false) |
144 | |
145 | self.messageCenter:unsubscribeAll(self) |
146 | self:removeActionEvents() |
147 | |
148 | self.isActive = false |
149 | end |
delete
DescriptionDefinitiondelete()Code
79 | function GuiTopDownCursor:delete() |
80 | if self.isActive then |
81 | self:deactivate() |
82 | end |
83 | |
84 | if self.cursorOverlay ~= nil then |
85 | self.cursorOverlay:delete() |
86 | self.cursorOverlay = nil |
87 | end |
88 | |
89 | if self.rootNode ~= nil then |
90 | delete(self.rootNode) |
91 | end |
92 | end |
mouseEvent
DescriptionHandle mouse moves that are not caught by actions.Definition
mouseEvent()Code
497 | function GuiTopDownCursor:mouseEvent(posX, posY, isDown, isUp, button) |
498 | if self.mouseDisabled then |
499 | return |
500 | end |
501 | |
502 | -- if self.isMouseMode and not self.isCatchingCursor then |
503 | -- self.mousePosX = posX |
504 | -- self.mousePosY = posY |
505 | -- end |
506 | |
507 | if self.lastActionFrame >= g_time then |
508 | return |
509 | end |
510 | |
511 | -- Mouse move only happens when other actions did not |
512 | if self.isCatchingCursor then |
513 | self.isCatchingCursor = false |
514 | self.inputManager:setShowMouseCursor(true, true) |
515 | |
516 | wrapMousePosition(self.lockedMousePosX, self.lockedMousePosY) |
517 | |
518 | self.inputManager.mousePosXLast, self.inputManager.mousePosYLast = self.lockedMousePosX, self.lockedMousePosY |
519 | |
520 | self.mousePosX = self.lockedMousePosX |
521 | self.mousePosY = self.lockedMousePosY |
522 | else |
523 | if self.isMouseMode then |
524 | self.mousePosX = posX |
525 | self.mousePosY = posY |
526 | end |
527 | end |
528 | end |
onInputModeChanged
DescriptionCalled when the mouse input mode changes.Definition
onInputModeChanged()Code
570 | function GuiTopDownCursor:onInputModeChanged(inputMode) |
571 | self.isMouseMode = inputMode[1] == GS_INPUT_HELP_MODE_KEYBOARD |
572 | |
573 | -- Reset to center of screen |
574 | if not self.isMouseMode then |
575 | self.mousePosX = 0.5 |
576 | self.mousePosY = 0.5 |
577 | end |
578 | end |
registerActionEvents
DescriptionRegister required action events for the cursor.Definition
registerActionEvents()Code
479 | function GuiTopDownCursor:registerActionEvents() |
480 | local _, eventId = self.inputManager:registerActionEvent(InputAction.AXIS_CONSTRUCTION_CURSOR_ROTATE, self, self.onRotate, false, false, true, false) |
481 | self.rotateEventId = eventId |
482 | |
483 | self.inputManager:setActionEventActive(self.rotateEventId, self.rotationEnabled) |
484 | self.inputManager:setActionEventTextPriority(self.rotateEventId, GS_PRIO_NORMAL) |
485 | end |
removeActionEvents
DescriptionRemove action events registered for the cursor.Definition
removeActionEvents()Code
489 | function GuiTopDownCursor:removeActionEvents() |
490 | self.rotateEventId = nil |
491 | |
492 | self.inputManager:removeActionEventsByTarget(self) |
493 | end |