From acc56fc7c2bedde6eced005eab0a37b6281b9a23 Mon Sep 17 00:00:00 2001 From: jussi Date: Mon, 1 May 2023 18:23:36 +0300 Subject: Texture now can be either Texture or RenderTexture. No need to change texture source anymore. --- src/state.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index ed96115..6db0812 100644 --- a/src/state.c +++ b/src/state.c @@ -16,7 +16,6 @@ bool stateInit( const char *exePath ) { state->run = true; state->resolution = (Vector2){ 800, 600 }; state->luaState = NULL; - state->textureSource = TEXTURE_SOURCE_TEXTURE; state->guiFont = 0; /* Images. */ state->imageAlloc = ALLOC_PAGE_SIZE; @@ -25,11 +24,7 @@ bool stateInit( const char *exePath ) { /* Textures. */ state->textureAlloc = ALLOC_PAGE_SIZE; state->textureCount = 0; - state->textures = malloc( state->textureAlloc * sizeof( Texture2D* ) ); - /* RenderTextures. */ - state->renderTextureAlloc = ALLOC_PAGE_SIZE; - state->renderTextureCount = 0; - state->renderTextures = malloc( state->renderTextureAlloc * sizeof( RenderTexture2D* ) ); + state->textures = malloc( state->textureAlloc * sizeof( ReiTexture* ) ); /* Fonts. */ state->fontAlloc = ALLOC_PAGE_SIZE; state->fontCount = 1; @@ -82,7 +77,6 @@ bool stateInit( const char *exePath ) { for ( int i = 0; i < ALLOC_PAGE_SIZE; i++ ) { state->images[i] = NULL; state->textures[i] = NULL; - state->renderTextures[i] = NULL; state->waves[i] = NULL; state->sounds[i] = NULL; state->camera2Ds[i] = NULL; @@ -133,16 +127,10 @@ void stateFree() { } for ( int i = 0; i < state->textureCount; ++i ) { if ( state->textures[i] != NULL ) { - UnloadTexture( *state->textures[i] ); + texturesFreeTexture(i); free( state->textures[i] ); } } - for ( int i = 0; i < state->renderTextureCount; ++i ) { - if ( state->renderTextures[i] != NULL ) { - UnloadRenderTexture( *state->renderTextures[i] ); - free( state->renderTextures[i] ); - } - } for ( int i = 0; i < state->fontCount; ++i ) { if ( state->fonts[i] != NULL ) { UnloadFont( *state->fonts[i] ); @@ -232,7 +220,6 @@ void stateFree() { } free( state->images ); free( state->textures ); - free( state->renderTextures ); free( state->fonts ); free( state->waves ); free( state->sounds ); -- cgit v1.2.3