Update C sources and examples
This commit is contained in:
parent
3b28d17b95
commit
8f1ad11c49
100 changed files with 2081 additions and 1686 deletions
|
@ -12,10 +12,10 @@ func main() {
|
|||
|
||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||
|
||||
// Load RAW image data (512x512, 32bit RGBA, no file header)
|
||||
sonicRaw := raylib.LoadImageRaw("texture_formats/sonic_R8G8B8A8.raw", 512, 512, raylib.UncompressedR8g8b8a8, 0)
|
||||
sonic := raylib.LoadTextureFromImage(sonicRaw) // Upload CPU (RAM) image to GPU (VRAM)
|
||||
raylib.UnloadImage(sonicRaw) // Unload CPU (RAM) image data
|
||||
// Load RAW image data (384x512, 32bit RGBA, no file header)
|
||||
fudesumiRaw := raylib.LoadImageRaw("texture_formats/fudesumi.raw", 384, 512, raylib.UncompressedR8g8b8a8, 0)
|
||||
fudesumi := raylib.LoadTextureFromImage(fudesumiRaw) // Upload CPU (RAM) image to GPU (VRAM)
|
||||
raylib.UnloadImage(fudesumiRaw) // Unload CPU (RAM) image data
|
||||
|
||||
// Generate a checked texture by code (1024x1024 pixels)
|
||||
width := 1024
|
||||
|
@ -27,9 +27,9 @@ func main() {
|
|||
for y := 0; y < height; y++ {
|
||||
for x := 0; x < width; x++ {
|
||||
if ((x/32+y/32)/1)%2 == 0 {
|
||||
pixels[y*height+x] = raylib.DarkBlue
|
||||
pixels[y*height+x] = raylib.Orange
|
||||
} else {
|
||||
pixels[y*height+x] = raylib.SkyBlue
|
||||
pixels[y*height+x] = raylib.Gold
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,18 +46,18 @@ func main() {
|
|||
|
||||
raylib.ClearBackground(raylib.RayWhite)
|
||||
|
||||
raylib.DrawTexture(checked, screenWidth/2-checked.Width/2, screenHeight/2-checked.Height/2, raylib.Fade(raylib.White, 0.3))
|
||||
raylib.DrawTexture(sonic, 330, -20, raylib.White)
|
||||
raylib.DrawTexture(checked, screenWidth/2-checked.Width/2, screenHeight/2-checked.Height/2, raylib.Fade(raylib.White, 0.5))
|
||||
raylib.DrawTexture(fudesumi, 430, -30, raylib.White)
|
||||
|
||||
raylib.DrawText("CHECKED TEXTURE ", 84, 100, 30, raylib.DarkBlue)
|
||||
raylib.DrawText("GENERATED by CODE", 72, 164, 30, raylib.DarkBlue)
|
||||
raylib.DrawText("and RAW IMAGE LOADING", 46, 226, 30, raylib.DarkBlue)
|
||||
raylib.DrawText("CHECKED TEXTURE ", 84, 100, 30, raylib.Brown)
|
||||
raylib.DrawText("GENERATED by CODE", 72, 164, 30, raylib.Brown)
|
||||
raylib.DrawText("and RAW IMAGE LOADING", 46, 226, 30, raylib.Brown)
|
||||
|
||||
raylib.EndDrawing()
|
||||
}
|
||||
|
||||
raylib.UnloadTexture(sonic) // Texture unloading
|
||||
raylib.UnloadTexture(checked) // Texture unloading
|
||||
raylib.UnloadTexture(fudesumi) // Texture unloading
|
||||
raylib.UnloadTexture(checked) // Texture unloading
|
||||
|
||||
raylib.CloseWindow()
|
||||
}
|
||||
|
|
BIN
examples/textures/raw_data/texture_formats/fudesumi.raw
Normal file
BIN
examples/textures/raw_data/texture_formats/fudesumi.raw
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue