Add more test code

master
Marrub 2017-09-21 21:55:22 -04:00
parent 4ad3bfa3e2
commit 41a7af85dd
1 changed files with 46 additions and 6 deletions

View File

@ -6,25 +6,62 @@
#include <stdio.h>
// Extern Objects ------------------------------------------------------------|
char const *G_place = u8"地球軌道・朝";
// Static Functions ----------------------------------------------------------|
//
// R_drawHitboxes
//
static void R_drawHitboxes(void)
{
DGE_Texture_Bind(0);
DGE_Draw_SetColor(1lr, 0, 0, 0.5lr);
unsigned head = DGE_Thinker_Head();
DGE_Point2 vp = DGE_Renderer_GetViewpoint();
for(DGE_Thinker th = {head}; (th.id = th.next) != head;) {
DGE_PhysicsThinker pth;
if((pth.id = DGE_Object_Cast(th.id, DGE_OT_PhysicsThinker))) {
fixed tx = pth.x - vp.x, ty = pth.y - vp.y;
DGE_Draw_Rectangle(tx - pth.sx, ty - pth.sy, tx + pth.sx, ty + pth.sy);
}
}
DGE_Draw_SetColor();
}
//
// R_Draw
//
static DGE_Callback void R_Draw(ulfra delta)
{
DGE_Shader_Bind(DGE_Shader_Get(s"plasma"));
DGE_Texture_Bind(0);
DGE_Draw_Rectangle(0, 0, 960, 720);
DGE_Shader_Bind(0);
}
//
// R_DrawPost
//
static DGE_Callback void R_DrawPost(ulfra delta)
{
static char const *place = u8"地球軌道・朝";
DGE_Texture_Bind(DGE_Texture_Get(s"@textures/Border.png"));
DGE_Texture_Bind(DGE_Texture_Get(s"gui/border"));
DGE_Draw_Rectangle(0, 0, 960, 720);
DGE_Font_Bind(DGE_Font_Get(s"myfont"));
DGE_Font_Bind(DGE_Font_Get(s"base"));
DGE_Draw_SetTextAlign(DGE_Align_Center);
DGE_Draw_Text(760, 20, place);
DGE_Draw_Text(760, 20, G_place);
DGE_Draw_SetTextAlign(DGE_Align_Left);
DGE_Draw_Text(585, 70, u8"ハイスコア\nスコア\n\n再試行回");
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));
R_drawHitboxes();
}
//
@ -37,6 +74,8 @@ static void G_Stage_Begin(unsigned stagenum)
// Extern Functions ----------------------------------------------------------|
void R_ResDec_Load(char const *fname);
//
// main
//
@ -60,6 +99,7 @@ void main(void)
G_ObjDef_Load("objdefs.dod");
printf("Registering callbacks...\n");
DGE_Callback_Register(DGE_CB_Draw, (DGE_CallbackType)R_Draw);
DGE_Callback_Register(DGE_CB_DrawPost, (DGE_CallbackType)R_DrawPost);
printf("Ready.\n");