UFO: Alien Invasion
ui_node_battlescape.cpp
Go to the documentation of this file.
1
8/*
9Copyright (C) 2002-2022 UFO: Alien Invasion.
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26*/
27
28#include "../ui_nodes.h"
29#include "../ui_behaviour.h"
31#include "ui_node_battlescape.h"
32#include "../../client.h"
33
34#include "../../../common/scripts_lua.h"
35
39static void UI_SetRenderRect (int x, int y, int width, int height)
40{
41 viddef.x = x * viddef.rx;
42 viddef.y = y * viddef.ry;
43 viddef.viewWidth = width * viddef.rx;
44 viddef.viewHeight = height * viddef.ry;
45}
46
51{
52 /* node->ghost = true; */
53}
54
56{
58 vec2_t pos;
59 UI_GetNodeAbsPos(node, pos);
60 UI_SetRenderRect(pos[0], pos[1], node->box.size[0], node->box.size[1]);
61}
62
64{
65 vec2_t pos;
66 UI_GetNodeAbsPos(node, pos);
67 UI_SetRenderRect(pos[0], pos[1], node->box.size[0], node->box.size[1]);
68}
69
70
72{
73 vec2_t pos;
74 UI_GetNodeAbsPos(node, pos);
75 UI_SetRenderRect(pos[0], pos[1], node->box.size[0], node->box.size[1]);
76}
77
79{
80 UI_SetRenderRect(0, 0, 0, 0);
81}
82
86bool uiBattleScapeNode::onScroll (uiNode_t* node, int deltaX, int deltaY)
87{
88 while (deltaY < 0) {
90 deltaY++;
91 }
92 while (deltaY > 0) {
94 deltaY--;
95 }
96 return true;
97}
98
100{
101 behaviour->name = "battlescape";
102 behaviour->manager = UINodePtr(new uiBattleScapeNode());
103 behaviour->lua_SWIG_typeinfo = UI_SWIG_TypeQuery("uiBattlescapeNode_t *");
104}
void CL_CameraZoomIn(void)
Zooms the scene of the battlefield in.
Definition: cl_camera.cpp:302
void CL_CameraZoomOut(void)
Zooms the scene of the battlefield out.
Definition: cl_camera.cpp:325
viddef_t viddef
Definition: cl_video.cpp:34
void onLoading(uiNode_t *node) override
Call before the script initialized the node.
void draw(uiNode_t *node) override
void onSizeChanged(uiNode_t *node) override
Callback stub.
void onWindowClosed(uiNode_t *node) override
void onWindowOpened(uiNode_t *node, linkedList_t *params) override
bool onScroll(uiNode_t *node, int deltaX, int deltaY) override
Called when user request scrolling on the battlescape.
node behaviour, how a node work
Definition: ui_behaviour.h:39
const char * name
Definition: ui_behaviour.h:41
void * lua_SWIG_typeinfo
Definition: ui_behaviour.h:57
UINodePtr manager
Definition: ui_behaviour.h:43
vec2_t size
Definition: ui_nodes.h:52
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
uiBox_t box
Definition: ui_nodes.h:96
float ry
Definition: cl_video.h:72
int viewHeight
Definition: cl_video.h:76
int x
Definition: cl_video.h:76
int viewWidth
Definition: cl_video.h:76
int y
Definition: cl_video.h:76
float rx
Definition: cl_video.h:71
vec_t vec2_t[2]
Definition: ufotypes.h:38
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
Definition: ui_node.cpp:514
SharedPtr< uiNode > UINodePtr
static void UI_SetRenderRect(int x, int y, int width, int height)
Determine the position and size of the render.
void UI_RegisterBattlescapeNode(uiBehaviour_t *behaviour)