From d563c2de0379481358727fb6ed59e1a75f347dbb Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 19 May 2011 03:41:47 +0200 Subject: updated HUD --- src/wm_hud.cpp | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/wm_hud.cpp b/src/wm_hud.cpp index 46efd54..d38b8c8 100644 --- a/src/wm_hud.cpp +++ b/src/wm_hud.cpp @@ -30,16 +30,22 @@ int dWMHud_c::onCreate() { static const char *brlanNames[3] = {"maphud_hitbutton.brlan", "maphud_in.brlan", "maphud_out.brlan"}; static const char *groupNames[4] = {"B01_Button", "B02_Button", "A00_Window", "A00_Window"}; - OSReport("Going to build\n"); bool output = layout.build("maphud.brlyt"); - OSReport("Returned %d\n", output); + + if (!IsWideScreen()) { + layout.clippingEnabled = true; + layout.clipX = 0; + layout.clipY = 52; + layout.clipWidth = 640; + layout.clipHeight = 352; + layout.layout.rootPane->scale.x = 0.7711f; + layout.layout.rootPane->scale.y = 0.7711f; + } + layout.loadAnimations(brlanNames, 3); - OSReport("Animations loaded\n"); layout.loadGroups(groupNames, (int[4]){0, 0, 1, 2}, 4); - OSReport("Groups loaded\n"); layout.disableAllAnimations(); - OSReport("Animations disabled\n"); - layout.enableNonLoopAnim(2); + //layout.enableNonLoopAnim(2); //layout.findTextBoxByName("T_area_01")->AllocStringBuffer(100); @@ -71,41 +77,28 @@ int dWMHud_c::onDraw() { void dWMHud_c::updateText() { - u16 newPointName[120]; - - OSReport("Updating text.\n"); + wchar_t newPointName[120]; // figure this out... - WMPathPoint *point = dScNewerWorldMap_c::instance->currentPoint; - OSReport("Obtained point: %p\n", point); + WMPathPoint *point = dWMPathManager_c::instance->currentPoint; if (point->type == WMPathPoint::LEVEL_TYPE) { - OSReport("It's a level: %d, %d\n", point->params[0], point->params[1]); - LevelInfo *li = &dScNewerWorldMap_c::instance->levelInfo; LevelInfo::Entry *entry = li->search(point->params[0] - 1, point->params[1] - 1); - OSReport("Got entry: %p\n", entry); - char *levelName = li->getNameForLevel(entry); - OSReport("Got name: %s\n", levelName); - OSReport("Length: %d\n", entry->nameLength); - // copy it // I need to make this into a function. for (int i = 0; i < 120 && i < entry->nameLength; i++) { newPointName[i] = levelName[i]; } newPointName[entry->nameLength] = 0; + } else { - OSReport("No name!\n"); newPointName[0] = 0; } - nw4r::lyt::TextBox *t = layout.findTextBoxByName("T_area_01"); - OSReport("TextBox: %p\n", t); - layout.findTextBoxByName("T_area_01")->SetString((wchar_t*)newPointName); - OSReport("Set it to T_area_01\n"); + layout.findTextBoxByName("T_area_01")->SetString(newPointName); } -- cgit v1.2.3