-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzglStatic.cpp
executable file
·55 lines (41 loc) · 1.13 KB
/
zglStatic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "zglStatic.h"
zglStatic::zglStatic()
{
m_flag |= FLAG_DISABLE; //!< Disable the Static
m_map_flag = FLAG_MAPPING_STATIC;
}
void zglStatic::init(zglTexture * tex, unsigned int width, unsigned int height)
{
zglWidget2D::init();
m_prim.init(DRAW_TRI_STRIP, m_vertex, 4, (zglTexture *) tex);
m_prim.setBlendType(BLEND_HALF);
//m_prim.setSortOffset(0x70); //!< Move to background
//!< Update the dimension, and request updating the vertex.
m_width = width;
m_height = height;
}
void zglStatic::setTexCoord(float left, float top, float right, float bottom)
{
m_vertex[0].setUV(left, top);
m_vertex[1].setUV(left, bottom);
m_vertex[2].setUV(right, top);
m_vertex[3].setUV(right, bottom);
applyVertexUpdate();
}
bool zglStatic::onTouchEvent(zglTouchEvent *event)
{
return false;
}
bool zglStatic::hitTest(float x, float y)
{
return false;
}
void zglStatic::updateDimension()
{
float width2 = m_width * 0.5f;
float height2 = m_height * 0.5f;
m_vertex[0].setPos(-width2, height2, 0.0f);
m_vertex[1].setPos(-width2, -height2, 0.0f);
m_vertex[2].setPos(width2, height2, 0.0f);
m_vertex[3].setPos(width2, -height2, 0.0f);;
}