| 1 |
// |
| 2 |
// Copyright(C) 2023 by Ryan Krafnick |
| 3 |
// |
| 4 |
// This program is free software; you can redistribute it and/or |
| 5 |
// modify it under the terms of the GNU General Public License |
| 6 |
// as published by the Free Software Foundation; either version 2 |
| 7 |
// of the License, or (at your option) any later version. |
| 8 |
// |
| 9 |
// This program is distributed in the hope that it will be useful, |
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
// GNU General Public License for more details. |
| 13 |
// |
| 14 |
// DESCRIPTION: |
| 15 |
// DSDA Map Title HUD Component |
| 16 |
// |
| 17 |
|
| 18 |
#include "base.h" |
| 19 |
|
| 20 |
#include "map_title.h" |
| 21 |
|
| 22 |
typedef struct { |
| 23 |
dsda_text_t component; |
| 24 |
} local_component_t; |
| 25 |
|
| 26 |
static local_component_t* local; |
| 27 |
|
| 28 |
static void dsda_UpdateComponentText(char* str, size_t max_size) { |
| 29 |
extern dsda_string_t hud_title; |
| 30 |
|
| 31 |
snprintf( |
| 32 |
str, |
| 33 |
max_size, |
| 34 |
"%s%s", |
| 35 |
dsda_TextColor(dsda_tc_map_title), |
| 36 |
hud_title.string |
| 37 |
); |
| 38 |
} |
| 39 |
|
| 40 |
void dsda_InitMapTitleHC(int x_offset, int y_offset, int vpt, int* args, int arg_count, void** data) { |
| 41 |
*data = Z_Calloc(1, sizeof(local_component_t)); |
| 42 |
local = *data; |
| 43 |
|
| 44 |
dsda_InitBlockyHC(&local->component, x_offset, y_offset, vpt); |
| 45 |
} |
| 46 |
|
| 47 |
void dsda_UpdateMapTitleHC(void* data) { |
| 48 |
local = data; |
| 49 |
|
| 50 |
dsda_UpdateComponentText(local->component.msg, sizeof(local->component.msg)); |
| 51 |
dsda_RefreshHudText(&local->component); |
| 52 |
} |
| 53 |
|
| 54 |
void dsda_DrawMapTitleHC(void* data) { |
| 55 |
local = data; |
| 56 |
|
| 57 |
dsda_DrawBasicText(&local->component); |
| 58 |
} |