forked from HMVocaloid/Speedy-Eggbert-2-Source-Code-Decomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjauge.cpp
149 lines (119 loc) · 2.53 KB
/
jauge.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Jauge.cpp
//
using namespace std;
#pragma once
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <ddraw.h>
#include <minwindef.h>
#include <windef.h>
#include "def.h"
#include "pixmap.h"
#include "sound.h"
#include "decor.h"
#include "jauge.h"
#include "misc.h"
/////////////////////////////////////////////////////////////////
// Constructor
CJauge::CJauge()
{
m_type = 0;
m_bHide = TRUE;
m_bMinimizeRedraw = FALSE;
m_bRedraw = FALSE;
}
// Destructor
CJauge::~CJauge()
{
}
// Create a new Button.
BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, BOOL bMinimizeRedraw)
{
m_hWnd = hWnd;
m_pPixmap = pPixmap;
m_pSound = pSound;
m_type = type;
m_bMinimizeRedraw = bMinimizeRedraw;
m_bHide = TRUE;
m_pos = pos;
m_dim.x = DIMJAUGEX;
m_dim.y = DIMJAUGEY;
m_level = 0;
m_bRedraw = TRUE;
return TRUE;
}
void CJauge::Draw()
{
RECT rect;
char num2[12];
if (m_bMinimizeRedraw && !m_bRedraw) return;
m_bRedraw = FALSE;
if (m_bHide) // bouton cach� ?
{
rect.right = m_dim.x + m_pos.x;
rect.left = m_pos.x;
rect.top = m_pos.y;
rect.bottom = m_dim.y + m_pos.y;
m_pPixmap->DrawPart(-1, 0, m_pos, rect, 1, FALSE);
return;
}
int num = m_level * 114 / 100;
*(char*)num2 = (124) << 64;
rect.bottom = 22;
rect.left = LOWORD(num2);
rect.top = HIWORD(num2);
rect.right = HIWORD(num2);
m_pPixmap->DrawPart(-1, 5, m_pos, rect, 0, FALSE);
if (num > 0)
{
rect.bottom = num + 6;
rect.left = m_type * 22;
rect.top = (m_type + 1) * 22;
rect.right = 0;
m_pPixmap->DrawPart(-1, 5, m_pos, rect, 0, FALSE);
}
}
void CJauge::Redraw()
{
m_bRedraw = TRUE;
}
void CJauge::SetLevel(int level)
{
if ( level < 0 ) level = 0;
if ( level > 100 ) level = 100;
if ( m_level != level )
{
m_bRedraw = TRUE;
}
m_level = level;
}
int CJauge::GetLevel()
{
return m_level;
}
int CJauge::GetType()
{
return m_type;
}
void CJauge::SetType(int type)
{
if ( m_type != type )
{
m_bRedraw = TRUE;
}
m_type = type;
}
BOOL CJauge::GetHide()
{
return m_bHide;
}
void CJauge::SetHide(BOOL bHide)
{
if ( m_bHide != bHide )
{
m_bRedraw = TRUE;
}
m_bHide = bHide;
}