From f9691757816123487ae201885566f996c40f5561 Mon Sep 17 00:00:00 2001 From: hgn Date: Thu, 1 May 2025 19:20:26 +0100 Subject: [PATCH] change imgui api & steam friends images --- vg_framebuffer.c | 2 +- vg_steam_friends.h | 8 ++++++-- vg_steam_utils.h | 3 +++ vg_ui/imgui.c | 8 ++++++-- vg_ui/imgui.h | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/vg_framebuffer.c b/vg_framebuffer.c index 9cc045c..95776b7 100644 --- a/vg_framebuffer.c +++ b/vg_framebuffer.c @@ -400,7 +400,7 @@ void vg_framebuffer_ui( ui_context *ctx ) } ui_rect_center( frame, img ); - ui_image( ctx, img, &fb->attachments[j].id ); + ui_image( ctx, img, &fb->attachments[j].id, 0 ); } ui_rect panel; diff --git a/vg_steam_friends.h b/vg_steam_friends.h index 04685a8..08e8400 100644 --- a/vg_steam_friends.h +++ b/vg_steam_friends.h @@ -69,6 +69,9 @@ static inline ISteamFriends *SteamAPI_SteamFriends(void) return SteamAPI_SteamFriends_v017(); } +int SteamAPI_ISteamFriends_GetSmallFriendAvatar( ISteamFriends* self, u64_steamid steamIDFriend ); +int SteamAPI_ISteamFriends_GetMediumFriendAvatar( ISteamFriends* self, u64_steamid steamIDFriend ); +int SteamAPI_ISteamFriends_GetLargeFriendAvatar( ISteamFriends* self, u64_steamid steamIDFriend ); const char *SteamAPI_ISteamFriends_GetPersonaName( ISteamFriends* self ); const char *SteamAPI_ISteamFriends_GetFriendPersonaName( ISteamFriends* self, u64 steamIDFriend ); @@ -109,5 +112,6 @@ enum EFriendFlags{ k_EFriendFlagAll = 0xFFFF, }; -steamapi_bool SteamAPI_ISteamFriends_HasFriend( ISteamFriends* self, - u64_steamid steamIDFriend, int iFriendFlags ); +steamapi_bool SteamAPI_ISteamFriends_HasFriend( ISteamFriends* self, u64_steamid steamIDFriend, int iFriendFlags ); + +u64_steamid SteamAPI_ISteamUser_GetSteamID( ISteamUser* self ); diff --git a/vg_steam_utils.h b/vg_steam_utils.h index 43f8bba..966b38b 100644 --- a/vg_steam_utils.h +++ b/vg_steam_utils.h @@ -63,3 +63,6 @@ ESteamInputType SteamAPI_ISteamInput_GetInputTypeForHandle( ISteamInput* self, InputHandle_t inputHandle ); void SteamAPI_ISteamInput_RunFrame( ISteamInput* self, steamapi_bool bReservedValue ); + +steamapi_bool SteamAPI_ISteamUtils_GetImageSize( ISteamUtils* self, int iImage, u32 *pnWidth, u32 *pnHeight ); +steamapi_bool SteamAPI_ISteamUtils_GetImageRGBA( ISteamUtils* self, int iImage, u8 *pubDest, int nDestBufferSize ); diff --git a/vg_ui/imgui.c b/vg_ui/imgui.c index 051e0ba..26736f0 100644 --- a/vg_ui/imgui.c +++ b/vg_ui/imgui.c @@ -659,10 +659,14 @@ void ui_spacer( ui_context *ctx, ui_rect inout_panel ) ui_fill( ctx, inner, ui_colour( ctx, k_ui_bg+6 ) ); } -void ui_image( ui_context *ctx, ui_rect rect, void *resource ) +void ui_image( ui_context *ctx, ui_rect rect, void *resource, bool flip ) { ui_flush( ctx, k_ui_shader_colour, NULL ); - ui_fill_rect( ctx, rect, 0xffffffff, (ui_px[4]){ 0,256,256,0 } ); + + if( flip ) + ui_fill_rect( ctx, rect, 0xffffffff, (ui_px[4]){ 0,0,256,256 } ); + else + ui_fill_rect( ctx, rect, 0xffffffff, (ui_px[4]){ 0,256,256,0 } ); struct ui_batch_shader_data_image inf = { .resource = resource }; ui_flush( ctx, k_ui_shader_image, &inf ); diff --git a/vg_ui/imgui.h b/vg_ui/imgui.h index 626f161..25f360c 100644 --- a/vg_ui/imgui.h +++ b/vg_ui/imgui.h @@ -308,7 +308,7 @@ void ui_panel( ui_context *ctx, ui_rect in_rect, ui_rect out_panel ); void ui_label( ui_context *ctx, ui_rect rect, const char *text, ui_px size, ui_px gap, ui_rect r ); void ui_info( ui_context *ctx, ui_rect inout_panel, const char *text ); void ui_spacer( ui_context *ctx, ui_rect inout_panel ); -void ui_image( ui_context *ctx, ui_rect rect, void *resource ); +void ui_image( ui_context *ctx, ui_rect rect, void *resource, bool flip ); enum ui_button_state ui_button_base( ui_context *ctx, ui_rect rect ); -- 2.25.1