UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
uiGeoscapeNode Class Reference

#include <ui_node_geoscape.h>

Inherits uiLocatedNode.

Public Member Functions

void draw (uiNode_t *node) override
 
void onMouseUp (uiNode_t *node, int x, int y, int button) override
 
void onCapturedMouseMove (uiNode_t *node, int x, int y) override
 
void onCapturedMouseLost (uiNode_t *node) override
 Called when the node have lost the captured node We clean cached data. More...
 
void onLoading (uiNode_t *node) override
 Called before loading. Used to set default attribute values. More...
 
bool onScroll (uiNode_t *node, int deltaX, int deltaY) override
 
void onLeftClick (uiNode_t *node, int x, int y) override
 
bool onStartDragging (uiNode_t *node, int startX, int startY, int currentX, int currentY, int button) override
 Send mouse event when a pressed mouse button is dragged. More...
 
void zoom (uiNode_t *node, bool out)
 
void startMouseShifting (uiNode_t *node, int x, int y)
 
- Public Member Functions inherited from uiLocatedNode
virtual void drawTooltip (const uiNode_t *node, int x, int y) const
 
virtual void drawOverWindow (uiNode_t *node)
 
virtual void doLayout (uiNode_t *node)
 Call to update the node layout. This common code revalidates the node tree. More...
 
virtual void onSizeChanged (uiNode_t *node)
 Callback stub. More...
 
virtual void onRightClick (uiNode_t *node, int x, int y)
 
virtual void onMiddleClick (uiNode_t *node, int x, int y)
 
virtual void onMouseMove (uiNode_t *node, int x, int y)
 
virtual void onMouseDown (uiNode_t *node, int x, int y, int button)
 
virtual bool onMouseLongPress (uiNode_t *node, int x, int y, int button)
 Send mouse event when a pressed mouse button is dragged. More...
 
virtual void onMouseEnter (uiNode_t *node)
 
virtual void onMouseLeave (uiNode_t *node)
 
virtual bool onDndEnter (uiNode_t *node)
 
virtual bool onDndMove (uiNode_t *node, int x, int y)
 
virtual void onDndLeave (uiNode_t *node)
 
virtual bool onDndDrop (uiNode_t *node, int x, int y)
 
virtual bool onDndFinished (uiNode_t *node, bool isDropped)
 
virtual void onFocusGained (uiNode_t *node)
 
virtual void onFocusLost (uiNode_t *node)
 
virtual bool onKeyPressed (uiNode_t *node, unsigned int key, unsigned short unicode)
 
virtual bool onKeyReleased (uiNode_t *node, unsigned int key, unsigned short unicode)
 
virtual void getClientPosition (uiNode_t const *node, vec2_t position)
 
virtual int getCellWidth (uiNode_t *node)
 
virtual int getCellHeight (uiNode_t *node)
 
- Public Member Functions inherited from uiNode
virtual void onLoaded (uiNode_t *node)
 
virtual void clone (uiNode_t const *source, uiNode_t *clone)
 
virtual void initNode (uiNode_t *node)
 
virtual void initNodeDynamic (uiNode_t *node)
 
virtual void deleteNode (uiNode_t *node)
 
virtual void onWindowOpened (uiNode_t *node, linkedList_t *params)
 
virtual void onWindowClosed (uiNode_t *node)
 
virtual void onWindowActivate (uiNode_t *node)
 
virtual void onActivate (uiNode_t *node)
 Activate the node. Can be used without the mouse (ie. a button will execute onClick) More...
 
virtual void onPropertyChanged (uiNode_t *node, const value_t *property)
 
virtual ~uiNode ()
 

Protected Member Functions

void smoothTranslate (uiNode_t *node)
 smooth translation of the 2D geoscape More...
 
void smoothRotate (uiNode_t *node)
 smooth rotation of the 3D geoscape More...
 
void screenTo3DMap (const uiNode_t *node, int x, int y, vec2_t pos)
 Return longitude and latitude of a point of the screen for 3D geoscape (globe) More...
 
void screenToMap (const uiNode_t *node, int x, int y, vec2_t pos)
 Return longitude and latitude of a point of the screen for 2D geoscape. More...
 
void calcAndUploadDayAndNightTexture (uiNode_t *node, float q)
 Applies alpha values to the night overlay image for 2d geoscape. More...
 

Detailed Description

Definition at line 31 of file ui_node_geoscape.h.

Member Function Documentation

void uiGeoscapeNode::calcAndUploadDayAndNightTexture ( uiNode_t node,
float  q 
)
protected

Applies alpha values to the night overlay image for 2d geoscape.

Parameters
[in]nodeThe current menuNode we have clicked on (3dmap or map)
[in]qThe angle the sun is standing against the equator on earth

Definition at line 177 of file ui_node_geoscape.cpp.

References COS_ALPHA, DAN_HEIGHT, DAN_WIDTH, DAWN, HIGH_LAT, LOW_LAT, M_PI, R_UploadAlpha(), SIN_ALPHA, and UI_MAPEXTRADATA.

Referenced by draw().

void uiGeoscapeNode::onCapturedMouseLost ( uiNode_t node)
overridevirtual

Called when the node have lost the captured node We clean cached data.

Reimplemented from uiLocatedNode.

Definition at line 484 of file ui_node_geoscape.cpp.

References MODE_NULL.

void uiGeoscapeNode::onCapturedMouseMove ( uiNode_t node,
int  x,
int  y 
)
overridevirtual

Mouse move event in the node when captured

Reimplemented from uiLocatedNode.

Definition at line 291 of file ui_node_geoscape.cpp.

References uiNode_t::box, i, MODE_SHIFT2DMAP, MODE_SHIFT3DMAP, MODE_ZOOMMAP, mousePosX, mousePosY, oldMousePosX, oldMousePosY, PITCH, ROTATE_SPEED, uiBox_t::size, UI_MAPEXTRADATA, UI_MAPEXTRADATACONST, YAW, and zoom().

void uiGeoscapeNode::onLeftClick ( uiNode_t node,
int  x,
int  y 
)
overridevirtual

Left mouse click event in the node

Reimplemented from uiLocatedNode.

Definition at line 439 of file ui_node_geoscape.cpp.

References GAME_MapClick(), MODE_NULL, screenTo3DMap(), screenToMap(), and UI_MAPEXTRADATACONST.

void uiGeoscapeNode::onLoading ( uiNode_t node)
overridevirtual

Called before loading. Used to set default attribute values.

this is the data that is used with r_dayandnightTexture

Reimplemented from uiNode.

Definition at line 522 of file ui_node_geoscape.cpp.

References uiNode_t::color, DAN_HEIGHT, DAN_WIDTH, EXTRADATA, geoscapeData, GLOBE_ROTATE, it_effect, Mem_AllocTypeN, OBJZERO, R_LoadImageData(), RADAR_HEIGHT, RADAR_WIDTH, Vector2Set, Vector4Set, VectorSet, XVI_HEIGHT, XVI_WIDTH, and YAW.

void uiGeoscapeNode::onMouseUp ( uiNode_t node,
int  x,
int  y,
int  button 
)
overridevirtual

Mouse button up event in the node

Reimplemented from uiLocatedNode.

Definition at line 472 of file ui_node_geoscape.cpp.

References MODE_NULL, and UI_MouseRelease().

bool uiGeoscapeNode::onScroll ( uiNode_t node,
int  deltaX,
int  deltaY 
)
overridevirtual

Mouse wheel event in the node

Reimplemented from uiLocatedNode.

Definition at line 510 of file ui_node_geoscape.cpp.

References down, and zoom().

bool uiGeoscapeNode::onStartDragging ( uiNode_t node,
int  startX,
int  startY,
int  currentX,
int  currentY,
int  button 
)
overridevirtual

Send mouse event when a pressed mouse button is dragged.

Returns
True if the event is used

Reimplemented from uiLocatedNode.

Definition at line 455 of file ui_node_geoscape.cpp.

References K_MOUSE1, K_MOUSE2, K_MOUSE3, MODE_ZOOMMAP, oldMousePosX, oldMousePosY, startMouseShifting(), startX, startY, and UI_SetMouseCapture().

void uiGeoscapeNode::screenTo3DMap ( const uiNode_t node,
int  x,
int  y,
vec2_t  pos 
)
protected

Return longitude and latitude of a point of the screen for 3D geoscape (globe)

Parameters
[in]nodeThe current menuNode we have clicked on (3dmap or map)
[in]x,yCoordinates on the screen that were clicked on
[out]posvec2_t was filled with longitude and latitude
See also
MAP_3DMapToScreen

Definition at line 392 of file ui_node_geoscape.cpp.

References f, GLOBE_RADIUS, PITCH, RotatePointAroundVector(), UI_MAPEXTRADATACONST, v, VecToPolar(), Vector2Set, VectorNormalize(), VectorSet, and YAW.

Referenced by onLeftClick().

void uiGeoscapeNode::screenToMap ( const uiNode_t node,
int  x,
int  y,
vec2_t  pos 
)
protected

Return longitude and latitude of a point of the screen for 2D geoscape.

Parameters
[in]nodeThe current menuNode we have clicked on (3dmap or map)
[in]x,yCoordinates on the screen that were clicked on
[out]posvec2_t was filled with longitude and latitude

Definition at line 372 of file ui_node_geoscape.cpp.

References UI_MAPEXTRADATACONST.

Referenced by onLeftClick().

void uiGeoscapeNode::smoothRotate ( uiNode_t node)
protected

smooth rotation of the 3D geoscape

Note
updates slowly values of angles and zoom so that its value goes to smoothFinalGlobeAngle

Definition at line 97 of file ui_node_geoscape.cpp.

References f, SMOOTHACCELERATION, UI_MAPEXTRADATA, UI_MAPEXTRADATACONST, VectorAdd, VectorCopy, VectorLength(), VectorScale, and VectorSubtract.

Referenced by draw().

void uiGeoscapeNode::smoothTranslate ( uiNode_t node)
protected

smooth translation of the 2D geoscape

Note
updates slowly values of center so that its value goes to smoothFinal2DGeoscapeCenter
updates slowly values of zoom so that its value goes to ZOOM_LIMIT

Definition at line 153 of file ui_node_geoscape.cpp.

References length, SMOOTHING_STEP_2D, UI_MAPEXTRADATA, and UI_MAPEXTRADATACONST.

Referenced by draw().

void uiGeoscapeNode::startMouseShifting ( uiNode_t node,
int  x,
int  y 
)
void uiGeoscapeNode::zoom ( uiNode_t node,
bool  out 
)

Zoom on the node

Todo:
it should use an int param for smooth zoom

Definition at line 493 of file ui_node_geoscape.cpp.

References UI_MAPEXTRADATA, and UI_MAPEXTRADATACONST.

Referenced by draw(), onCapturedMouseMove(), onScroll(), UI_GeoscapeNodeZoomIn(), and UI_GeoscapeNodeZoomOut().


The documentation for this class was generated from the following files: