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