Hud.
This commit is contained in:
parent
7f22f5e950
commit
abfd6df63b
|
@ -2,7 +2,7 @@ VERSION = 0.1
|
|||
REVISION = $(shell git rev-list HEAD 2>/dev/null | wc -l)
|
||||
LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po))
|
||||
|
||||
SEARCHPATH += src src/game src/system src/util src/world
|
||||
SEARCHPATH += src src/game src/system src/util src/widgets src/world
|
||||
vpath %.c $(SEARCHPATH)
|
||||
vpath %.h $(SEARCHPATH)
|
||||
|
||||
|
@ -11,11 +11,13 @@ DEPS += defs.h structs.h
|
|||
OBJS += camera.o
|
||||
OBJS += draw.o
|
||||
OBJS += game.o
|
||||
OBJS += hud.o
|
||||
OBJS += init.o input.o io.o
|
||||
OBJS += lookup.o
|
||||
OBJS += main.o map.o maths.o
|
||||
OBJS += text.o textures.o title.o
|
||||
OBJS += util.o
|
||||
OBJS += widgets.o
|
||||
|
||||
# top-level rule to create the program.
|
||||
all: $(PROG) $(LOCALE_MO)
|
||||
|
|
|
@ -94,6 +94,14 @@ enum
|
|||
TA_CENTER
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MSG_STANDARD,
|
||||
MSG_GAMEPLAY,
|
||||
MSG_PROGRESS,
|
||||
MSG_OBJECTIVE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CH_PLAYER,
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "widgets.h"
|
||||
|
||||
void showWidgetGroup(char *groupName)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "hud.h"
|
||||
|
||||
static int messageTime;
|
||||
static char message[MAX_DESCRIPTION_LENGTH];
|
||||
static int messageType;
|
||||
|
||||
static char infoMessage[MAX_DESCRIPTION_LENGTH];
|
||||
|
||||
void initHud(void)
|
||||
{
|
||||
messageTime = FPS * 2;
|
||||
messageType = MSG_STANDARD;
|
||||
}
|
||||
|
||||
void doLogic(void)
|
||||
{
|
||||
messageTime--;
|
||||
|
||||
if (messageTime <= 0)
|
||||
{
|
||||
messageType = MSG_STANDARD;
|
||||
|
||||
messageTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void setGameplayMessage(char *newMessage, int newMessageType)
|
||||
{
|
||||
if (newMessageType >= messageType && newMessage != NULL)
|
||||
{
|
||||
STRNCPY(message, newMessage, MAX_DESCRIPTION_LENGTH);
|
||||
messageType = newMessageType;
|
||||
messageTime = FPS * 3;
|
||||
}
|
||||
}
|
||||
|
||||
void showInfoMessage(char *newInfoMessage)
|
||||
{
|
||||
STRNCPY(infoMessage, newInfoMessage, MAX_DESCRIPTION_LENGTH);
|
||||
|
||||
showWidgetGroup("ok");
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
extern void showWidgetGroup(char *groupName);
|
Loading…
Reference in New Issue