Browse Source

Add resource declarations to MFEd

master
Marrub 5 years ago
parent
commit
10986d286b
  1. 7
      data_mfed/resdecl_mfed.rd
  2. 8
      src/g_player.c
  3. 2
      src/g_stage.c
  4. 2
      src/g_stage.h
  5. 6
      src/main.c
  6. 5
      src/mfed.c
  7. 4
      src/r_draw.c

7
data_mfed/resdecl_mfed.rd

@ -0,0 +1,7 @@
// Copyright © 2017 Project Golan, all rights reserved.
include "resdecl.rd"
font "editor" = "fonts/editor.otf", 24
// EOF

8
src/g_player.c

@ -12,10 +12,10 @@
//
// G_Player_applyVelocity
//
void G_Player_applyVelocity(DGE_Entity ent)
static void G_Player_applyVelocity(DGE_Entity ent)
{
accum vx = (accum)DGE_GetInputAxis(0, DGE_Axis_X);
accum vy = (accum)DGE_GetInputAxis(0, DGE_Axis_Y);
DGE_Point2R ax = DGE_Input_GetAxis(1);
accum vx = (accum)ax.x, vy = (accum)ax.y;
float mag = sqrtf(vx * vx + vy * vy);
float ang = atan2f(vy, vx);
@ -25,6 +25,8 @@ void G_Player_applyVelocity(DGE_Entity ent)
ent.vx = ent.vx + c * mag * 1.1;
ent.vy = ent.vy - s * mag * 1.1;
// TODO: apply animation based on X velocity here
}
// Extern Functions ----------------------------------------------------------|

2
src/g_stage.c

@ -13,7 +13,7 @@
// Extern Objects ------------------------------------------------------------|
char const *G_place = u8"地球軌道・朝";
char const *G_Place = u8"地球軌道・朝";
// Static Functions ----------------------------------------------------------|

2
src/g_stage.h

@ -41,7 +41,7 @@ typedef struct G_stage
// Extern Objects ------------------------------------------------------------|
extern char const *G_place;
extern char const *G_Place;
// Extern Functions ----------------------------------------------------------|

6
src/main.c

@ -12,7 +12,7 @@
//
// GInit
//
void GInit(void)
void GInit(char const *resdecl)
{
extern void R_ResDec_Load(char const *fname);
@ -23,7 +23,7 @@ void GInit(void)
DGE_Renderer_SetVirtualRes(960, 720);
printf("Loading resource declarations...\n");
R_ResDec_Load("resdecl.rd");
R_ResDec_Load(resdecl);
printf("Loading object function table...\n");
G_ObjDef_Init();
@ -45,7 +45,7 @@ void GInit(void)
[[__extern("asm")]] DGE_Callback
void main(void)
{
GInit();
GInit("resdecl.rd");
G_Stage_Begin(1);
}

5
src/mfed.c

@ -15,9 +15,8 @@
[[__extern("asm")]] DGE_Callback
void main(void)
{
extern void GInit(void);
GInit();
printf("using mfed main\n");
extern void GInit(char const *resdecl);
GInit("resdecl_mfed.rd");
}
// EOF

4
src/r_draw.c

@ -54,8 +54,8 @@ void R_DrawPost(ulfra delta)
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_Center, DGE_Align_Top);
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);

Loading…
Cancel
Save