summaryrefslogtreecommitdiff
path: root/src/koopatlas/hud.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-20 17:29:47 +0200
committerTreeki <treeki@gmail.com>2012-09-20 17:29:47 +0200
commitf21117a1ebb837fec02b42a3808896d6edb4ccf6 (patch)
treeec9487cdf364bfa21fbc282c4d091f1e0e0ef16d /src/koopatlas/hud.cpp
parent05eb1400faaa957905fbbe8fa284df4ab1472a58 (diff)
downloadkamek-f21117a1ebb837fec02b42a3808896d6edb4ccf6.tar.gz
kamek-f21117a1ebb837fec02b42a3808896d6edb4ccf6.zip
beginnings of the new HUD
Diffstat (limited to 'src/koopatlas/hud.cpp')
-rw-r--r--src/koopatlas/hud.cpp48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp
index bdd51b0..b7e40d2 100644
--- a/src/koopatlas/hud.cpp
+++ b/src/koopatlas/hud.cpp
@@ -16,17 +16,19 @@ dWMHud_c::dWMHud_c() {
layoutLoaded = false;
}
+enum WMHudAnimation {
+ SHOW_LIVES = 0,
+ SHOW_HEADER,
+ SHOW_FOOTER
+};
+
int dWMHud_c::onCreate() {
if (!layoutLoaded) {
- bool gotFile = layout.loadArc("maphud.arc", false);
+ bool gotFile = layout.loadArc("MapHUD.arc", false);
if (!gotFile)
return false;
- //static const char *brlanNames[3] = {"maphud_hitbutton.brlan", "maphud_in.brlan", "maphud_out.brlan"};
- static const char *brlanNames[5] = {"maphud_hitbutton.brlan", "bottom_in.brlan", "bottom_out.brlan", "top_in.brlan", "top_out.brlan"};
- static const char *groupNames[6] = {"B01_Button", "B02_Button", "A00_Window", "A00_Window", "A01_Window", "A01_Window"};
-
bool output = layout.build("maphud.brlyt");
if (!IsWideScreen()) {
@@ -39,10 +41,19 @@ int dWMHud_c::onCreate() {
layout.layout.rootPane->scale.y = 0.7711f;
}
- layout.loadAnimations(brlanNames, 5);
- layout.loadGroups(groupNames, (int[6]){0, 0, 1, 2, 3, 4}, 6);
+ static const char *brlanNames[2] = {"MapHUD_ShowMain.brlan", "MapHUD_ShowHeader.brlan"};
+ static const char *groupNames[3] = {"G_Lives", "G_Header", "G_Footer"};
+
+ layout.loadAnimations(brlanNames, 2);
+ layout.loadGroups(groupNames, (int[3]){0, 1, 0}, 3);
layout.disableAllAnimations();
+ layout.enableNonLoopAnim(SHOW_LIVES);
+ layout.enableNonLoopAnim(SHOW_FOOTER);
+
+ static const char *tbNames[2] = {"MenuButtonInfo", "ItemsButtonInfo"};
+ layout.setLangStrings(tbNames, (int[2]){12, 15}, 4, 2);
+
layoutLoaded = true;
}
@@ -51,11 +62,17 @@ int dWMHud_c::onCreate() {
int dWMHud_c::onDelete() {
+ if (!layoutLoaded)
+ return true;
+
return layout.free();
}
int dWMHud_c::onExecute() {
+ if (!layoutLoaded)
+ return true;
+
layout.execAnimations();
layout.update();
@@ -64,8 +81,25 @@ int dWMHud_c::onExecute() {
int dWMHud_c::onDraw() {
+ if (!layoutLoaded)
+ return true;
+
layout.scheduleForDrawing();
return true;
}
+
+
+
+void dWMHud_c::playShowHeaderAnim() {
+ layout.enableNonLoopAnim(SHOW_HEADER);
+}
+
+void dWMHud_c::playHideHeaderAnim() {
+ if (layout.isAnimOn(SHOW_HEADER)) {
+ layout.enableNonLoopAnim(SHOW_HEADER, true);
+ }
+ layout.grpHandlers[SHOW_HEADER].frameCtrl.flags = 2; // NO_LOOP | REVERSE
+}
+