Browse Source

Add basic game UI

master
Marrub 5 years ago
parent
commit
c87e35a647
  1. 12
      src/g_object.h
  2. 36
      src/main.c

12
src/g_object.h

@ -29,9 +29,6 @@
// Extern Functions ----------------------------------------------------------|
void G_ObjDef_Init(void);
void G_ObjDef_Load(char const *fname);
void G_ObjDef_LoadFunc(char const *name, DGE_CallbackType fptr);
struct G_entty const *G_ObjDef_GetType(char const *name);
struct G_anima const *G_ObjDef_GetAnim(struct G_entty const *type, char const *name);
@ -62,4 +59,13 @@ typedef struct G_entty // Entity Type
DGE_CallbackType task;
} G_entty;
// Extern Functions ----------------------------------------------------------|
void G_ObjDef_Init(void);
void G_ObjDef_Load(char const *fname);
void G_ObjDef_LoadFunc(char const *name, DGE_CallbackType fptr);
DGE_Entity G_Player_Create(fixed x, fixed y);
DGE_Callback void G_Player_Think(DGE_Entity ent);
#endif

36
src/main.c

@ -1,5 +1,6 @@
// Copyright © 2017 Project Golan, all rights reserved.
#include "g_object.h"
#include "m_str.h"
#include <Doominati.h>
@ -8,20 +9,33 @@
// Static Functions ----------------------------------------------------------|
//
// Draw
// R_DrawPost
//
static void Draw(ulfra delta)
static DGE_Callback void R_DrawPost(ulfra delta)
{
static char const *place = u8"地球軌道・朝";
DGE_Texture_Bind(DGE_Texture_Get(s"@textures/Border.png"));
DGE_Draw_Rectangle(0, 0, 960, 720);
DGE_Font_Bind(DGE_Font_Get(s"myfont"));
DGE_Draw_Text(20, 20,
u8"hello, world!? こんにちは、世界さん!?\n"
u8"¿¡hola, mundo!? 你好,世界!?\n"
u8"γειά σου κόσμε!? hej verden!?");
DGE_Draw_SetTextAlign(DGE_Align_Center);
DGE_Draw_Text(760, 20, place);
DGE_Draw_SetTextAlign(DGE_Align_Left);
DGE_Draw_Text(585, 70, u8"ハイスコア\nスコア\n\n再試行回");
DGE_Draw_SetTextAlign(DGE_Align_Right);
DGE_Draw_Text(945, 70, M_StrFmt("%.15i\n%.15i\n\n%i", 0, 0, 5));
}
// Extern Functions ----------------------------------------------------------|
//
// G_Stage_Begin
//
static void G_Stage_Begin(unsigned stagenum)
{
G_Player_Create(-200, 250);
}
extern void G_Player_Think(DGE_Entity);
// Extern Functions ----------------------------------------------------------|
//
// main
@ -33,7 +47,7 @@ void main(void)
u8"オミ:影響の目 1.0\n"
u8"Copyright © 2017 Project Golan, all rights reserved.\n\n");
DGE_Renderer_SetVirtualRes(640, 480);
DGE_Renderer_SetVirtualRes(960, 720);
printf("Loading object function table...\n");
G_ObjDef_Init();
@ -46,9 +60,11 @@ void main(void)
DGE_Font_Create(s"myfont", "fonts/base.ttf", 24);
printf("Registering callbacks...\n");
DGE_Callback_Register(DGE_CB_Draw, (DGE_CallbackType)Draw);
DGE_Callback_Register(DGE_CB_DrawPost, (DGE_CallbackType)R_DrawPost);
printf("Ready.\n");
G_Stage_Begin(1);
}
// EOF

Loading…
Cancel
Save