camcontrol: crude hack to hide all entities

This commit is contained in:
Andrei Alexeyev 2021-07-08 16:49:22 +03:00
parent efdaf51928
commit 4c203ed0bf
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -14,6 +14,7 @@
#include "coroutine.h"
#include "util/glm.h"
#include "video.h"
#include "entity.h"
#define CAMCTRL_MOVE_SPEED 0.1
// for scroll wheel move speed adjustment
@ -67,6 +68,15 @@ static bool wheel_event(SDL_Event *e, void *a) {
return false;
}
static void nodraw(EntityInterface *ent) { }
static void predraw(EntityInterface *ent, void *a) {
if(ent) {
// super lame hack to hide everything
ent->draw_func = nodraw;
}
}
TASK(camera_control, { Camera3D *cam; }) {
Camera3D *cam = ARGS.cam;
@ -87,6 +97,8 @@ TASK(camera_control, { Camera3D *cam; }) {
&(EventHandler) { .proc = wheel_event, .arg = &move_speed, .event_type = SDL_MOUSEWHEEL }
);
ent_hook_pre_draw(predraw, NULL);
Font *fnt = res_font("monotiny");
StageText *txt = stagetext_add(
NULL, I*font_get_lineskip(fnt)/2, ALIGN_LEFT, fnt, RGB(1,1,1), 0, 9000000, 0, 0