// Copyright © 2017 Project Golan, all rights reserved. #include "g_object.h" #include "m_str.h" #include #include // 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) { DGE_Texture_Bind(DGE_Texture_Get(s"gui/border")); DGE_Draw_Rectangle(0, 0, 960, 720); DGE_Font_Bind(DGE_Font_Get(s"base")); DGE_Draw_SetTextAlign(DGE_Align_Center); DGE_Draw_Text(760, 20, G_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)); R_drawHitboxes(); } // // G_Stage_Begin // static void G_Stage_Begin(unsigned stagenum) { G_Player_Create(-200, 250); } // Extern Functions ----------------------------------------------------------| void R_ResDec_Load(char const *fname); // // main // [[__extern("asm")]] DGE_Callback void main(void) { printf("\n=====================\n" u8"オミ:影響の目 1.0\n" u8"Copyright © 2017 Project Golan, all rights reserved.\n\n"); DGE_Renderer_SetVirtualRes(960, 720); printf("Loading resource declarations...\n"); R_ResDec_Load("resdecl.rd"); printf("Loading object function table...\n"); G_ObjDef_Init(); G_ObjDef_loadFunc(G_Player_Think); printf("Loading object definitions...\n"); 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"); G_Stage_Begin(1); } // EOF