Load zigzag texture.

This commit is contained in:
Bartosz Taudul 2023-04-27 21:59:43 +02:00
parent 42aeece7fd
commit 62ec968f24
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -45,6 +45,7 @@
#include "../../server/IconsFontAwesome6.h"
#include "icon.hpp"
#include "zigzag.hpp"
#include "Backend.hpp"
#include "ConnectionHistory.hpp"
@ -95,6 +96,9 @@ static uint8_t* iconPx;
static int iconX, iconY;
static void* iconTex;
static int iconTexSz;
static uint8_t* zigzagPx;
static int zigzagX, zigzagY;
static void* zigzagTex;
static Backend* bptr;
static bool s_customTitle = false;
static bool s_isElevated = false;
@ -219,12 +223,14 @@ int main( int argc, char** argv )
auto iconThread = std::thread( [] {
iconPx = stbi_load_from_memory( (const stbi_uc*)Icon_data, Icon_size, &iconX, &iconY, nullptr, 4 );
zigzagPx = stbi_load_from_memory( (const stbi_uc*)ZigZag_data, ZigZag_size, &zigzagX, &zigzagY, nullptr, 4 );
} );
ImGuiTracyContext imguiContext;
Backend backend( title, DrawContents, &mainThreadTasks );
tracy::InitTexture();
iconTex = tracy::MakeTexture();
zigzagTex = tracy::MakeTexture( true );
iconThread.join();
backend.SetIcon( iconPx, iconX, iconY );
bptr = &backend;
@ -239,6 +245,10 @@ int main( int argc, char** argv )
SetupDPIScale( dpiScale, s_fixedWidth, s_bigFont, s_smallFont );
tracy::UpdateTextureRGBA( zigzagTex, zigzagPx, zigzagX, zigzagY );
tracy::MakeMipMaps( zigzagTex );
free( zigzagPx );
if( initFileOpen )
{
view = std::make_unique<tracy::View>( RunOnMainThread, *initFileOpen, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
@ -260,6 +270,7 @@ int main( int argc, char** argv )
if( updateNotesThread.joinable() ) updateNotesThread.join();
view.reset();
tracy::FreeTexture( zigzagTex, RunOnMainThread );
tracy::FreeTexture( iconTex, RunOnMainThread );
free( iconPx );