Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions examples/examples.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
GLFW_ICON ICON "raylib.ico"

1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
//BLOCK "080904E4" // English UK
BLOCK "040904E4" // English US
BEGIN
VALUE "CompanyName", "raylib technologies"
VALUE "FileDescription", "raylib example"
VALUE "FileVersion", "1.0"
VALUE "InternalName", "raylib-example"
VALUE "LegalCopyright", "(c) 2024 raylib technologies (@raylibtech)"
//VALUE "OriginalFilename", "raylib_app.exe"
VALUE "ProductName", "raylib-example"
VALUE "ProductVersion", "1.0"
END
END
BLOCK "VarFileInfo"
BEGIN
//VALUE "Translation", 0x809, 1252 // English UK
VALUE "Translation", 0x409, 1252 // English US
END
END
5 changes: 2 additions & 3 deletions examples/models/models_skybox.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ int main(void)
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
Model skybox = LoadModelFromMesh(cube);

bool useHDR = true;
// Set this to true to use an HDR Texture, Note that raylib must be built with HDR Support for this to work SUPPORT_FILEFORMAT_HDR
bool useHDR = false;

// Load skybox shader and set required locations
// NOTE: Some locations are automatically set at shader loading
Expand Down Expand Up @@ -157,8 +158,6 @@ int main(void)
DrawGrid(10, 1.0f);

EndMode3D();

//DrawTextureEx(panorama, (Vector2){ 0, 0 }, 0.0f, 0.5f, WHITE);

if (useHDR) DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
else DrawText(TextFormat(": %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
Expand Down
Binary file added examples/raylib.ico
Binary file not shown.
106 changes: 106 additions & 0 deletions examples/textures/textures_image_channel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*******************************************************************************************
*
* raylib [textures] example - Retrive image channel (mask)
*
* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
*
* Example originally created with raylib 5.1-dev, last time updated with raylib 5.1-dev
*
* Example contributed by Bruno Cabral (github.com/brccabral) and reviewed by Ramon Santamaria (@raysan5)
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2024-2024 Bruno Cabral (github.com/brccabral) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/

#include <raylib.h>

//------------------------------------------------------------------------------------
// Program main entry point
//------------------------------------------------------------------------------------
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------

const int screenWidth = 800;
const int screenHeight = 450;

InitWindow(screenWidth, screenHeight, "raylib [textures] example - extract channel from image");

Image fudesumiImage = LoadImage("resources/fudesumi.png");

Image imageAlpha = ImageFromChannel(fudesumiImage, 3);
ImageAlphaMask(&imageAlpha, imageAlpha);

Image imageRed = ImageFromChannel(fudesumiImage, 0);
ImageAlphaMask(&imageRed, imageAlpha);

Image imageGreen = ImageFromChannel(fudesumiImage, 1);
ImageAlphaMask(&imageGreen, imageAlpha);

Image imageBlue = ImageFromChannel(fudesumiImage, 2);
ImageAlphaMask(&imageBlue, imageAlpha);

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);

UnloadImage(fudesumiImage);
UnloadImage(imageAlpha);
UnloadImage(imageRed);
UnloadImage(imageGreen);
UnloadImage(imageBlue);
UnloadImage(backgroundImage);

SetTargetFPS(60); // Set our game to run at 60 frames-per-second

Rectangle fudesumiRec = {0, 0, fudesumiImage.width, fudesumiImage.height};

Rectangle fudesumiPos = {50, 10, fudesumiImage.width*0.8f, fudesumiImage.height*0.8f};
Rectangle redPos = { 410, 10, fudesumiPos.width / 2, fudesumiPos.height / 2 };
Rectangle greenPos = { 600, 10, fudesumiPos.width / 2, fudesumiPos.height / 2 };
Rectangle bluePos = { 410, 230, fudesumiPos.width / 2, fudesumiPos.height / 2 };
Rectangle alphaPos = { 600, 230, fudesumiPos.width / 2, fudesumiPos.height / 2 };

//--------------------------------------------------------------------------------------

// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();

DrawTexture(backgroundTexture, 0, 0, WHITE);
DrawTexturePro(fudesumiTexture, fudesumiRec, fudesumiPos, (Vector2) {0, 0}, 0, WHITE);

DrawTexturePro(textureRed, fudesumiRec, redPos, (Vector2) {0, 0}, 0, RED);
DrawTexturePro(textureGreen, fudesumiRec, greenPos, (Vector2) {0, 0}, 0, GREEN);
DrawTexturePro(textureBlue, fudesumiRec, bluePos, (Vector2) {0, 0}, 0, BLUE);
DrawTexturePro(textureAlpha, fudesumiRec, alphaPos, (Vector2) {0, 0}, 0, WHITE);

EndDrawing();
//----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(backgroundTexture);
UnloadTexture(fudesumiTexture);
UnloadTexture(textureRed);
UnloadTexture(textureGreen);
UnloadTexture(textureBlue);
UnloadTexture(textureAlpha);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

return 0;
}
Binary file added examples/textures/textures_image_channel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions parser/output/raylib_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -7183,6 +7183,21 @@
}
]
},
{
"name": "ImageFromChannel",
"description": "Create an image from a selected channel of another image (GRAYSCALE)",
"returnType": "Image",
"params": [
{
"type": "Image",
"name": "image"
},
{
"type": "int",
"name": "selectedChannel"
}
]
},
{
"name": "ImageText",
"description": "Create an image from text (default font)",
Expand Down
9 changes: 9 additions & 0 deletions parser/output/raylib_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5521,6 +5521,15 @@ return {
{type = "Rectangle", name = "rec"}
}
},
{
name = "ImageFromChannel",
description = "Create an image from a selected channel of another image (GRAYSCALE)",
returnType = "Image",
params = {
{type = "Image", name = "image"},
{type = "int", name = "selectedChannel"}
}
},
{
name = "ImageText",
description = "Create an image from text (default font)",
Expand Down
Loading