update librg

isolation_bkp/dynres
Dominik Madarász 2022-09-27 11:58:35 +00:00 committed by GitHub
parent c74c1efe7c
commit 7db50cc0d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 27 deletions

View File

@ -22,7 +22,7 @@ static asset assets[] = {
ASSET_TEX(ASSET_DEV),
ASSET_TEX(ASSET_GROUND),
ASSET_TEX(ASSET_DIRT),
ASSET_TEX(ASSET_WATER),
ASSET_ANI(ASSET_WATER),
ASSET_TEX(ASSET_LAVA),
ASSET_TEX(ASSET_WALL),
ASSET_TEX(ASSET_HILL),

View File

@ -33,11 +33,11 @@ Texture2D GenColorEco(Color color) {
Texture2D texgen_build_anim(asset_id id, int64_t counter) {
(void)counter;
switch (id) {
// case ASSET_WATER: {
// Image img = LoadImageEco("water");
// ImageColorBrightness(&img, zpl_abs((counter % 64 - 32)*2));
// return Image2TexEco(img);
// }break;
case ASSET_WATER: {
Image img = LoadImageEco("water");
ImageColorBrightness(&img, zpl_abs((counter % 64 - 32)*2));
return Image2TexEco(img);
}break;
default: return GenColorEco(PINK); break;
}
@ -61,7 +61,7 @@ Texture2D texgen_build_sprite(asset_id id) {
case ASSET_LAVA: return LoadTexEco("lava");
case ASSET_WOOD: return LoadTexEco("wood");
case ASSET_TREE: return LoadTexEco("tree");
case ASSET_WATER: return LoadTexEco("water");
// case ASSET_WATER: return LoadTexEco("water");
case ASSET_BELT:
case ASSET_BELT_RIGHT: return LoadTexEco("belt_right");

View File

@ -7,6 +7,20 @@ static float zoom_overlay_tran = 0.0f;
float zpl_lerp(float,float,float);
float zpl_to_degrees(float);
void DrawNametag(const char* name, uint64_t key, entity_view *data, float x, float y) {
float size = 16.f;
float font_size = lerp(4.0f, 32.0f, 0.5f/(float)render_camera.zoom);
float font_spacing = 1.1f;
float title_bg_offset = 4;
float fixed_title_offset = 8.f;
float health = (data->hp / data->max_hp);
const char *title = TextFormat("%s %llu", name, key);
float title_w = MeasureTextEco(title, font_size, font_spacing);
DrawRectangleEco(x-title_w/2.f-title_bg_offset/2.f, y-size-font_size-fixed_title_offset, title_w+title_bg_offset, font_size, ColorAlpha(BLACK, data->tran_time));
DrawRectangleEco(x-title_w/2.f-title_bg_offset/2.f, y-size-fixed_title_offset, title_w*health+title_bg_offset, font_size*0.2f, ColorAlpha(RED, data->tran_time));
DrawTextEco(title, x-title_w/2.f, y-size-font_size-fixed_title_offset, font_size, ColorAlpha(RAYWHITE, data->tran_time), font_spacing);
}
void DEBUG_draw_ground(uint64_t key, entity_view * data) {
switch (data->kind) {
case EKIND_CHUNK: {
@ -59,26 +73,19 @@ extern bool inv_is_open;
void DEBUG_draw_entities(uint64_t key, entity_view * data) {
float size = 16.f;
float font_size = lerp(4.0f, 32.0f, 0.5f/(float)render_camera.zoom);
float font_spacing = 1.1f;
float title_bg_offset = 4;
float fixed_title_offset = 8.f;
switch (data->kind) {
case EKIND_DEMO_NPC: {
float x = data->x;
float y = data->y;
DrawNametag("Demo", key, data, x, y);
DrawCircleEco(x, y, size, ColorAlpha(BLUE, data->tran_time));
}break;
case EKIND_PLAYER: {
float x = data->x;
float y = data->y;
float health = (data->hp / data->max_hp);
const char *title = TextFormat("Player %d", key);
float title_w = MeasureTextEco(title, font_size, font_spacing);
DrawRectangleEco(x-title_w/2.f-title_bg_offset/2.f, y-size-font_size-fixed_title_offset, title_w+title_bg_offset, font_size, ColorAlpha(BLACK, data->tran_time));
DrawRectangleEco(x-title_w/2.f-title_bg_offset/2.f, y-size-fixed_title_offset, title_w*health+title_bg_offset, font_size*0.2f, ColorAlpha(RED, data->tran_time));
DrawTextEco(title, x-title_w/2.f, y-size-font_size-fixed_title_offset, font_size, ColorAlpha(RAYWHITE, data->tran_time), font_spacing);
DrawNametag("Player", key, data, x, y);
DrawCircleEco(x, y, size, ColorAlpha(YELLOW, data->tran_time));
if (data->has_items && !data->inside_vehicle) {
@ -97,11 +104,7 @@ void DEBUG_draw_entities(uint64_t key, entity_view * data) {
case EKIND_MACRO_BOT: {
float x = data->x;
float y = data->y;
const char *title = TextFormat("Bot %d", key);
float title_w = MeasureTextEco(title, font_size, font_spacing);
DrawRectangleEco(x-title_w/2.f-title_bg_offset/2.f, y-size-font_size-fixed_title_offset, title_w+title_bg_offset, font_size, ColorAlpha(GRAY, data->tran_time));
DrawTextEco(title, x-title_w/2.f, y-size-font_size-fixed_title_offset, font_size, ColorAlpha(BLACK, data->tran_time), font_spacing);
DrawCircleEco(x, y, size, ColorAlpha(PURPLE, data->tran_time));
DrawNametag("Bot", key, data, x, y);
}break;
case EKIND_ITEM: {
float x = data->x - 32.f;

View File

@ -3,7 +3,7 @@
#define ITEM_PICK_RADIUS 25.0f
#define ITEM_MERGER_RADIUS 75.0f
#define ITEM_ATTRACT_RADIUS 75.0f
#define ITEM_ATTRACT_FORCE 6.f
#define ITEM_ATTRACT_FORCE .98f
#define ITEM_CONTAINER_REACH_RADIUS 105.0f
@ -13,7 +13,6 @@ void PickItem(ecs_iter_t *it) {
for (int i = 0; i < it->count; i++) {
if (inv[i].pickup_time > game_time()) continue;
inv[i].pickup_time = game_time() + 0.5f;
size_t ents_count;
int64_t *ents = world_chunk_query_entities(it->entities[i], &ents_count, 2);

View File

@ -156,8 +156,8 @@
#define LIBRG_H
#define LIBRG_VERSION_MAJOR 7
#define LIBRG_VERSION_MINOR 0
#define LIBRG_VERSION_PATCH 3
#define LIBRG_VERSION_MINOR 1
#define LIBRG_VERSION_PATCH 1
#define LIBRG_VERSION_PRE ""
// file: librg_hedley.h
@ -2213,7 +2213,7 @@ LIBRG_API int8_t librg_world_destroy(librg_world *world);
LIBRG_API int8_t librg_world_valid(librg_world *world);
LIBRG_API int8_t librg_world_userdata_set(librg_world *world, void *data);
LIBRG_API void * librg_world_userdata_get(librg_world *world);
LIBRG_API int64_t librg_world_entities_tracked();
LIBRG_API int64_t librg_world_entities_tracked(librg_world *world);
// =======================================================================//
// !
@ -22078,4 +22078,3 @@ LIBRG_END_C_DECLS
#endif // LIBRG_IMPLEMENTATION
#endif // LIBRG_H