-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzglEngineDebugger.cpp
executable file
·108 lines (87 loc) · 2.49 KB
/
zglEngineDebugger.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* Copyright (C) 2010 ZiiLABS Pte Ltd
* All Rights Reserved.
*
* This software and its associated documentation may contain some
* proprietary, confidential and trade secret information of
* ZiiLABS Pte Ltd and except as provided by written agreement with
* ZiiLABS Pte Ltd
*
* a) no part may be disclosed, distributed, reproduced, transmitted,
* transcribed, stored in a retrieval system, adapted or translated
* in any form or by any means electronic, mechanical, magnetic,
* optical, chemical, manual or otherwise,
*
* and
*
* b) the recipient is not entitled to discover through reverse
* engineering or reverse compiling or other such techniques or
* processes the trade secrets contained therein or in the
* documentation.
*/
#ifdef _DEBUG_
#include <stdio.h>
#include <stdlib.h>
#include "zglEngineDebugger.h"
#include "zglEngine.h"
#include "zglCore.h"
#include "zglUtil.h"
#include "zglEventType.h"
#include <math.h>
#include <time.h>
/************************************************************************/
void zglEngineDebugger::onFini(void)
{
}
void zglEngineDebugger::onResize(int w, int h)
{
}
void zglEngineDebugger::onInit()
{
//debug
m_debug_vertex[0].init(-100.0f, 100.0f, 0, 0.0f, 0.0f, 0xffffffff);
m_debug_vertex[1].init(-100.0f, -100.0f, 0, 0.0f, 1.0f, 0xffffffff);
m_debug_vertex[2].init( 100.0f, -100.0f, 0, 1.0f, 1.0f, 0xffffffff);
m_debug_vertex[3].init( 100.0f, 100.0f, 0, 1.0f, 0.0f, 0xffffffff);
m_debug_outline.init(DRAW_LINE_LOOP, m_debug_vertex, 4, NULL);
m_debug_outline.setVisible(false);
m_debug_text.init();
}
bool zglEngineDebugger::handleTouchEvent(int type, int x, int y, long time)
{
zglEngine * glEngine = zglEngine::getEngine();
zglWidget * w = glEngine->m_widget_list.hitTest(x, y);
switch(type)
{
case TOUCH_DOWN:
case TOUCH_MOVE:
m_debug_text.clear();
if(w != 0)
{
w->getBound(m_debug_vertex, &m_debug_vertex_count);
m_debug_outline.init(DRAW_LINE_LOOP, m_debug_vertex, m_debug_vertex_count, NULL);
sprintf(m_text, "[z = %d]", w->getZOffset());
m_debug_text.print(0, 0, m_text);
}
else
{
//m_debug_outline.setFlag(zglPrim::FLAG_INVISIBLE);
m_debug_outline.setVisible(false);
sprintf(m_text, "( %d, %d )", (int)x, (int)y);
m_debug_text.print(0, 0, m_text);
}
break;
case TOUCH_UP:
{
m_debug_outline.setVisible(false);
m_debug_text.clear();
}
break;
}
return true;
}
bool zglEngineDebugger::onUpdate(long time_val)
{
return true;
}
#endif //#ifdef _DEBUG_