Call "super init" during HUD model creation

This commit is contained in:
Aaron Culliney 2015-12-31 22:54:34 -08:00
parent abae59767c
commit a54a69efcc
5 changed files with 15 additions and 5 deletions

View File

@ -27,7 +27,7 @@ static GLModel *messageModel = NULL;
// ----------------------------------------------------------------------------
static void *_create_alert(void) {
GLModelHUDElement *hudElement = (GLModelHUDElement *)CALLOC(sizeof(GLModelHUDElement), 1);
GLModelHUDElement *hudElement = (GLModelHUDElement *)glhud_createDefault();
if (hudElement) {
hudElement->colorScheme = RED_ON_BLACK;
hudElement->blackIsTransparent = false;

View File

@ -13,7 +13,12 @@
#include "glvideo.h"
void *glhud_createDefault(void) {
GLModelHUDElement *hudElement = (GLModelHUDElement *)CALLOC(sizeof(GLModelHUDElement), 1);
return glhud_createCustom(sizeof(GLModelHUDElement));
}
void *glhud_createCustom(unsigned int sizeofModel) {
assert(sizeof(GLModelHUDElement) <= sizeofModel);
GLModelHUDElement *hudElement = (GLModelHUDElement *)CALLOC(sizeofModel, 1);
if (hudElement) {
hudElement->colorScheme = RED_ON_BLACK;
}

View File

@ -15,13 +15,15 @@
#include "common.h"
#include "video_util/modelUtil.h"
// HUD GLModel is basically just a quad/texture generated from the Apple //e bitmap font
#define HUD_CLASS(CLS, ...) \
MODEL_CLASS(CLS, \
char *tpl; /* ASCII template */ \
unsigned int tplWidth; /* template width */ \
unsigned int tplHeight; /* template height */ \
\
uint8_t *pixels; /* raw texture/FB data */ \
uint8_t *pixels; /* raw indexed data */ \
unsigned int pixWidth; /* FB width -- FIXME TODO : this is really the same as GLModel.texWidth */ \
unsigned int pixHeight; /* FB height -- FIXME TODO : this is really the same as GLModel.texHeight */ \
\
@ -37,6 +39,9 @@ HUD_CLASS(GLModelHUDElement);
// default model creation
void *glhud_createDefault(void);
// create custom HUD model
void *glhud_createCustom(unsigned int sizeofModel);
// default model setup
void glhud_setupDefault(GLModel *parent);

View File

@ -460,7 +460,7 @@ static void _setup_touchkbd_hud(GLModel *parent) {
}
static void *_create_touchkbd_hud(void) {
GLModelHUDKeyboard *hudKeyboard = (GLModelHUDKeyboard *)CALLOC(sizeof(GLModelHUDKeyboard), 1);
GLModelHUDKeyboard *hudKeyboard = (GLModelHUDKeyboard *)glhud_createCustom(sizeof(GLModelHUDKeyboard));
if (hudKeyboard) {
hudKeyboard->blackIsTransparent = true;
hudKeyboard->opaquePixelHalo = true;

View File

@ -352,7 +352,7 @@ static void _setup_touchmenu(GLModel *parent) {
}
static void *_create_touchmenu(void) {
GLModelHUDMenu *hudMenu = (GLModelHUDMenu *)CALLOC(sizeof(GLModelHUDMenu), 1);
GLModelHUDMenu *hudMenu = (GLModelHUDMenu *)glhud_createCustom(sizeof(GLModelHUDMenu));
if (hudMenu) {
hudMenu->blackIsTransparent = true;
hudMenu->opaquePixelHalo = true;