change texture2d to texture

This commit is contained in:
CrackedPixel 2024-08-07 19:42:06 -05:00
commit 1c829e7b81
24 changed files with 73 additions and 73 deletions

View file

@ -27,9 +27,9 @@ int main(void)
// NOTE: Be careful, background width must be equal or bigger than screen width
// if not, texture should be draw more than two times for scrolling effect
Texture2D background = LoadTexture("resources/cyberpunk_street_background.png");
Texture2D midground = LoadTexture("resources/cyberpunk_street_midground.png");
Texture2D foreground = LoadTexture("resources/cyberpunk_street_foreground.png");
Texture background = LoadTexture("resources/cyberpunk_street_background.png");
Texture midground = LoadTexture("resources/cyberpunk_street_midground.png");
Texture foreground = LoadTexture("resources/cyberpunk_street_foreground.png");
float scrollingBack = 0.0f;
float scrollingMid = 0.0f;

View file

@ -31,10 +31,10 @@ int main(void)
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Image bgImage = LoadImage("resources/cyberpunk_street_background.png"); // Loaded in CPU memory (RAM)
Texture2D bgTexture = LoadTextureFromImage(bgImage); // Image converted to texture, GPU memory (VRAM)
Texture bgTexture = LoadTextureFromImage(bgImage); // Image converted to texture, GPU memory (VRAM)
Image fgImage = LoadImage("resources/cyberpunk_street_foreground.png"); // Loaded in CPU memory (RAM)
Texture2D fgTexture = LoadTextureFromImage(fgImage); // Image converted to texture, GPU memory (VRAM)
Texture fgTexture = LoadTextureFromImage(fgImage); // Image converted to texture, GPU memory (VRAM)
// Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
UnloadImage(bgImage);

View file

@ -40,7 +40,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [textures] example - bunnymark");
// Load bunny texture
Texture2D texBunny = LoadTexture("resources/wabbit_alpha.png");
Texture texBunny = LoadTexture("resources/wabbit_alpha.png");
Bunny *bunnies = (Bunny *)malloc(MAX_BUNNIES*sizeof(Bunny)); // Bunnies array

View file

@ -21,7 +21,7 @@
#define COLOR_SIZE 16 // Size of the color select buttons
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint);
void DrawTextureTiled(Texture texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint);
//------------------------------------------------------------------------------------
// Program main entry point
@ -172,7 +172,7 @@ int main(void)
}
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint)
void DrawTextureTiled(Texture texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint)
{
if ((texture.id <= 0) || (scale <= 0.0f)) return; // Wanna see a infinite loop?!...just delete this line!
if ((source.width == 0) || (source.height == 0)) return;

View file

@ -39,7 +39,7 @@ int main(void)
// NOTE: We will update this texture when required with next frame data
// WARNING: It's not recommended to use this technique for sprites animation,
// use spritesheets instead, like illustrated in textures_sprite_anim example
Texture2D texScarfyAnim = LoadTextureFromImage(imScarfyAnim);
Texture texScarfyAnim = LoadTextureFromImage(imScarfyAnim);
unsigned int nextFrameDataOffset = 0; // Current byte offset to next frame in image.data

View file

@ -46,12 +46,12 @@ int main(void)
Image backgroundImage = GenImageChecked(screenWidth, screenHeight, screenWidth/20, screenHeight/20, ORANGE, YELLOW);
Texture2D fudesumiTexture = LoadTextureFromImage(fudesumiImage);
Texture2D textureAlpha = LoadTextureFromImage(imageAlpha);
Texture2D textureRed = LoadTextureFromImage(imageRed);
Texture2D textureGreen = LoadTextureFromImage(imageGreen);
Texture2D textureBlue = LoadTextureFromImage(imageBlue);
Texture2D backgroundTexture = LoadTextureFromImage(backgroundImage);
Texture fudesumiTexture = LoadTextureFromImage(fudesumiImage);
Texture textureAlpha = LoadTextureFromImage(imageAlpha);
Texture textureRed = LoadTextureFromImage(imageRed);
Texture textureGreen = LoadTextureFromImage(imageGreen);
Texture textureBlue = LoadTextureFromImage(imageBlue);
Texture backgroundTexture = LoadTextureFromImage(backgroundImage);
UnloadImage(fudesumiImage);
UnloadImage(imageAlpha);

View file

@ -55,7 +55,7 @@ int main(void)
UnloadFont(font); // Unload custom font (already drawn used on image)
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
Texture texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
SetTargetFPS(60);

View file

@ -37,7 +37,7 @@ int main(void)
Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f);
Image cellular = GenImageCellular(screenWidth, screenHeight, 32);
Texture2D textures[NUM_TEXTURES] = { 0 };
Texture textures[NUM_TEXTURES] = { 0 };
textures[0] = LoadTextureFromImage(verticalGradient);
textures[1] = LoadTextureFromImage(horizontalGradient);

View file

@ -78,10 +78,10 @@ int main(void)
ImageCrop(&catSharpend, (Rectangle){ 0, 0, (float)200, (float)450 });
// Images converted to texture, GPU memory (VRAM)
Texture2D texture = LoadTextureFromImage(image);
Texture2D catSharpendTexture = LoadTextureFromImage(catSharpend);
Texture2D catSobelTexture = LoadTextureFromImage(catSobel);
Texture2D catGaussianTexture = LoadTextureFromImage(catGaussian);
Texture texture = LoadTextureFromImage(image);
Texture catSharpendTexture = LoadTextureFromImage(catSharpend);
Texture catSobelTexture = LoadTextureFromImage(catSobel);
Texture catGaussianTexture = LoadTextureFromImage(catGaussian);
// Once images have been converted to texture and uploaded to VRAM,
// they can be unloaded from RAM

View file

@ -30,7 +30,7 @@ int main(void)
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Image image = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
Texture2D texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM)
Texture texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM)
UnloadImage(image); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
SetTargetFPS(60); // Set our game to run at 60 frames-per-second

View file

@ -59,7 +59,7 @@ int main(void)
Image imOrigin = LoadImage("resources/parrots.png"); // Loaded in CPU memory (RAM)
ImageFormat(&imOrigin, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); // Format image to RGBA 32bit (required for texture update) <-- ISSUE
Texture2D texture = LoadTextureFromImage(imOrigin); // Image converted to texture, GPU memory (VRAM)
Texture texture = LoadTextureFromImage(imOrigin); // Image converted to texture, GPU memory (VRAM)
Image imCopy = ImageCopy(imOrigin);

View file

@ -36,7 +36,7 @@ int main(void)
ImageRotate(&image90, 90);
ImageRotate(&imageNeg90, -90);
Texture2D textures[NUM_TEXTURES] = { 0 };
Texture textures[NUM_TEXTURES] = { 0 };
textures[0] = LoadTextureFromImage(image45);
textures[1] = LoadTextureFromImage(image90);

View file

@ -33,7 +33,7 @@ int main(void)
// Draw over image using custom font
ImageDrawTextEx(&parrots, font, "[Parrots font drawing]", (Vector2){ 20.0f, 20.0f }, (float)font.baseSize, 0.0f, RED);
Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
Texture texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM)
UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
Vector2 position = { (float)(screenWidth/2 - texture.width/2), (float)(screenHeight/2 - texture.height/2 - 20) };

View file

@ -26,7 +26,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
Texture texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
//---------------------------------------------------------------------------------------
// Main game loop

View file

@ -30,7 +30,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [textures] example - N-patch drawing");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D nPatchTexture = LoadTexture("resources/ninepatch_button.png");
Texture nPatchTexture = LoadTexture("resources/ninepatch_button.png");
Vector2 mousePosition = { 0 };
Vector2 origin = { 0.0f, 0.0f };

View file

@ -53,7 +53,7 @@ int main(void)
float gravity = 3.0f;
Texture2D smoke = LoadTexture("resources/spark_flame.png");
Texture smoke = LoadTexture("resources/spark_flame.png");
int blending = BLEND_ALPHA;

View file

@ -21,7 +21,7 @@
#define MAX_POINTS 11 // 10 points and back to the start
// Draw textured polygon, defined by vertex and texture coordinates
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint);
void DrawTexturePoly(Texture texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint);
//------------------------------------------------------------------------------------
// Program main entry point
@ -111,7 +111,7 @@ int main(void)
// Draw textured polygon, defined by vertex and texture coordinates
// NOTE: Polygon center must have straight line path to all points
// without crossing perimeter, points must be in anticlockwise order
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint)
void DrawTexturePoly(Texture texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint)
{
rlSetTexture(texture.id);

View file

@ -33,7 +33,7 @@ int main(void)
// Load RAW image data (512x512, 32bit RGBA, no file header)
Image fudesumiRaw = LoadImageRaw("resources/fudesumi.raw", 384, 512, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 0);
Texture2D fudesumi = LoadTextureFromImage(fudesumiRaw); // Upload CPU (RAM) image to GPU (VRAM)
Texture fudesumi = LoadTextureFromImage(fudesumiRaw); // Upload CPU (RAM) image to GPU (VRAM)
UnloadImage(fudesumiRaw); // Unload CPU (RAM) image data
// Generate a checked texture by code
@ -61,7 +61,7 @@ int main(void)
.mipmaps = 1
};
Texture2D checked = LoadTextureFromImage(checkedIm);
Texture checked = LoadTextureFromImage(checkedIm);
UnloadImage(checkedIm); // Unload CPU (RAM) image data (pixels)
//---------------------------------------------------------------------------------------

View file

@ -29,7 +29,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [texture] example - sprite anim");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
Texture scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
Vector2 position = { 350.0f, 280.0f };
Rectangle frameRec = { 0.0f, 0.0f, (float)scarfy.width/6, (float)scarfy.height };

View file

@ -30,7 +30,7 @@ int main(void)
InitAudioDevice(); // Initialize audio device
Sound fxButton = LoadSound("resources/buttonfx.wav"); // Load button sound
Texture2D button = LoadTexture("resources/button.png"); // Load button texture
Texture button = LoadTexture("resources/button.png"); // Load button texture
// Define frame rectangle for drawing
float frameHeight = (float)button.height/NUM_FRAMES;

Some files were not shown because too many files have changed in this diff Show more