// Copyright © 2017 Project Golan, all rights reserved. #include "g_object.h" #include "m_types.h" #include #include // Static Functions ----------------------------------------------------------| // // G_Player_Think // DGE_Callback static void G_Player_Think(DGE_Entity ent) { DGE_Object_RefAdd(ent.id); for(;;) { if(ent.health <= 0) break; ent.vx = ent.vx + (fixed)DGE_GetInputAxis(0, DGE_Axis_X); ent.vy = ent.vy - (fixed)DGE_GetInputAxis(0, DGE_Axis_Y); DGE_Task_Sleep(0, 1); } DGE_Object_RefSub(ent.id); } // // G_Player_Create // static DGE_Entity G_Player_Create(fixed x, fixed y) { DGE_Entity ent = {DGE_Entity_Create(0)}; ent.x = x; ent.y = y; G_entty const *type; if((type = G_ObjDef_GetType("Player"))) { G_ObjDef_setupEntity(type, ent); G_ObjDef_createTask (type, ent); } return ent; } // Extern Functions ----------------------------------------------------------| // // 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_SetVirtualResolution(640, 480); 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("Ready.\n"); G_Player_Create(32, 32); } // EOF