Register callbacks through __script attribute

master
Marrub 2017-09-29 22:10:46 -04:00
parent f6abfc7b8e
commit 866b3000e5
3 changed files with 4 additions and 27 deletions

View File

@ -2,7 +2,6 @@
#include "g_stage.h" #include "g_stage.h"
#include "g_object.h" #include "g_object.h"
#include "g_player.h" #include "g_player.h"
#include "r_draw.h"
#include "m_math.h" #include "m_math.h"
#include <Doominati.h> #include <Doominati.h>
@ -82,10 +81,6 @@ void GInit(char const *resdecl)
printf("Loading object definitions...\n"); printf("Loading object definitions...\n");
G_ObjDef_Load("objdefs.dod"); 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"); printf("Ready.\n");
} }

View File

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

View File

@ -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