+#include <stdio.h>
#include "client/camera.h"
#include "client/client.h"
#include "client/client_player.h"
client_player.obj->pos = client_player.pos;
object_transform(client_player.obj);
+
+ char pos_text[BUFSIZ];
+ sprintf(pos_text, "(%.1f %.1f %.1f)", client_player.pos.x, client_player.pos.y, client_player.pos.z);
+
+ hud_change_text(client_player.pos_display, pos_text);
}
void client_player_init(Map *map)
}
}
+ client_player.pos_display = hud_add((HUDElementDefinition) {
+ .type = HUD_TEXT,
+ .pos = {-1.0f, -1.0f, 0.0f},
+ .offset = {2, 2 + 16 + 2 + 16 + 2},
+ .type_def = {
+ .text = {
+ .text = "",
+ .color = {1.0f, 1.0f, 1.0f},
+ },
+ },
+ });
+
update_pos();
}
#define _CLIENT_PLAYER_H_
#include "client/client.h"
+#include "client/hud.h"
#include "client/object.h"
#include "types.h"
f32 eye_height;
Object *obj;
Map *map;
+ HUDElement *pos_display;
} client_player;
void client_player_init(Map *map);