Browse Source

Register callbacks through __script attribute

master
Marrub 5 years ago
parent
commit
866b3000e5
  1. 5
      src/main.c
  2. 12
      src/r_draw.c
  3. 14
      src/r_draw.h

5
src/main.c

@ -2,7 +2,6 @@
#include "g_stage.h"
#include "g_object.h"
#include "g_player.h"
#include "r_draw.h"
#include "m_math.h"
#include <Doominati.h>
@ -82,10 +81,6 @@ void GInit(char const *resdecl)
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");
}

12
src/r_draw.c

@ -1,6 +1,4 @@
// Copyright © 2017 Project Golan, all rights reserved.
#include "r_draw.h"
#include "g_stage.h"
#include "g_object.h"
#include "g_player.h"
@ -33,13 +31,11 @@ static void R_drawHitboxes(void)
DGE_Draw_SetColor();
}
// Extern Functions ----------------------------------------------------------|
//
// R_Draw
//
DGE_Callback
void R_Draw(ulfra delta)
DGE_Callback [[__script("Draw")]]
static void R_draw(ulfra delta)
{
DGE_Shader_Bind(DGE_Shader_Get(s"plasma"));
DGE_Texture_Bind(0);
@ -50,8 +46,8 @@ void R_Draw(ulfra delta)
//
// R_DrawPost
//
DGE_Callback
void R_DrawPost(ulfra delta)
DGE_Callback [[__script("DrawPost")]]
static void R_drawPost(ulfra delta)
{
DGE_Texture_Bind(DGE_Texture_Get(s"gui/border"));
DGE_Draw_Rectangle(0, 0, 960, 720);

14
src/r_draw.h

@ -1,14 +0,0 @@
// Copyright © 2017 Project Golan, all rights reserved.
#ifndef r_draw_h
#define r_draw_h
#include "m_types.h"
#include <Doominati.h>
// Extern Functions ----------------------------------------------------------|
DGE_Callback void R_Draw(ulfra delta);
DGE_Callback void R_DrawPost(ulfra delta);
#endif
Loading…
Cancel
Save