5#include <entt/core/type_info.hpp>
6#include <entt/entity/registry.hpp>
86 std::size_t bytes = 0);
100template <
class T,
class Fn>
103 [fn](
const entt::registry ®, entt::entity e) ->
json_value {
104 if constexpr (std::is_empty_v<T>) {
107 return fn(reg.get<T>(e));
110 std::is_empty_v<T> ? 0 :
sizeof(T));
void debug_watch(context &ctx, const char *name, json_value value)
Đặt một giá trị để xem trực tiếp trong bảng "Watches" của inspector: vận tốc nhân vật,...
render_info render_info_get(const context &ctx)
Số liệu vẽ của frame vừa rồi.
void debug_server_stop(context &ctx)
Đóng cổng debug và ngắt inspector đang kết nối.
std::function< json_value(const entt::registry &, entt::entity)> debug_component_fn
Hàm chuyển một component thành JSON để inspector hiện giá trị của nó.
Definition njin_debug.h:74
void debug_component(context &ctx, entt::id_type type, const char *name, debug_component_fn fn, std::size_t bytes=0)
Đăng ký cách hiện một loại component.
bool debug_server_connected(const context &ctx)
Có inspector nào đang kết nối không.
bool debug_server_start(context &ctx, const debug_server_desc &desc={})
Mở cổng debug để chương trình njin_inspector (một process riêng) kết nối vào: FPS,...
std::int32_t i32
Số nguyên có dấu 32 bit.
Definition _types.h:14
std::uint16_t u16
Số nguyên không dấu 16 bit.
Definition _types.h:21
float f32
Số thực 32 bit.
Definition _types.h:28
std::uint32_t u32
Số nguyên không dấu 32 bit.
Definition _types.h:22
Cách mở cổng debug, dùng với debug_server_start().
Definition njin_debug.h:17
f32 snapshot_hz
Số lần mỗi giây gửi danh sách entity và giá trị theo dõi.
Definition njin_debug.h:19
u16 port
Cổng TCP, chỉ nghe trên 127.0.0.1.
Definition njin_debug.h:18
i32 max_entities
Số entity tối đa trong mỗi lần gửi. Thừa thì cắt, inspector có báo.
Definition njin_debug.h:20
Một giá trị JSON: null, bool, số, chuỗi, mảng hoặc object.
Definition njin_json.h:33
static json_value make_object()
Một object rỗng.
Definition njin_json.h:69
Những gì frame vừa rồi đã vẽ, cho màn hình debug của chính game.
Definition njin_debug.h:115
u32 post_passes
Số pass toàn màn hình của hậu kỳ dựng sẵn và của ánh sáng.
Definition njin_debug.h:127
u32 lights
Đèn đã vẽ vào bản đồ ánh sáng (njin_light.h).
Definition njin_debug.h:128
u32 particles_gpu
Trong đó vẽ bằng GPU.
Definition njin_debug.h:122
u32 draw_calls
Số lệnh vẽ ước tính.
Definition njin_debug.h:126
u32 tile_chunks
Chunk tilemap đã vẽ.
Definition njin_debug.h:118
u32 emitters_culled
Emitter bị bỏ qua vì nằm ngoài camera.
Definition njin_debug.h:120
u32 particles
Hạt đã vẽ, cả CPU và GPU.
Definition njin_debug.h:121
u32 emitters
Emitter hạt đã vẽ.
Definition njin_debug.h:119
u32 instanced_calls
Lệnh vẽ instanced (mỗi emitter GPU một lệnh).
Definition njin_debug.h:123
u32 models3d_culled
Model 3D bị bỏ qua vì nằm ngoài tầm nhìn camera (vẫn đổ bóng).
Definition njin_debug.h:130
u32 sprites_culled
Sprite bị bỏ qua vì nằm ngoài camera.
Definition njin_debug.h:117
u32 models3d
Model 3D đã vẽ (draw_model(), njin::model3d).
Definition njin_debug.h:129
u32 sprites
Sprite đã vẽ.
Definition njin_debug.h:116
Vector 2 chiều. Dùng cho vị trí, kích thước, độ dời.
Definition _types.h:39