Avoid using DrawCubeTexture()

This commit is contained in:
Ray 2022-11-15 12:26:22 +01:00
parent fadc29d811
commit 3c51d066f1

View File

@ -15,7 +15,6 @@
#include "raylib.h" #include "raylib.h"
Texture2D textureGrid = { 0 };
Camera cameraPlayer1 = { 0 }; Camera cameraPlayer1 = { 0 };
Camera cameraPlayer2 = { 0 }; Camera cameraPlayer2 = { 0 };
@ -32,8 +31,8 @@ void DrawScene(void)
{ {
for (float z = -count*spacing; z <= count*spacing; z += spacing) for (float z = -count*spacing; z <= count*spacing; z += spacing)
{ {
DrawCubeTexture(textureGrid, (Vector3) { x, 1.5f, z }, 1, 1, 1, GREEN); DrawCube((Vector3) { x, 1.5f, z }, 1, 1, 1, LIME);
DrawCubeTexture(textureGrid, (Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN); DrawCube((Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
} }
} }
@ -54,13 +53,6 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen"); InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen");
// Generate a simple texture to use for trees
Image img = GenImageChecked(256, 256, 32, 32, DARKGRAY, WHITE);
textureGrid = LoadTextureFromImage(img);
UnloadImage(img);
SetTextureFilter(textureGrid, TEXTURE_FILTER_ANISOTROPIC_16X);
SetTextureWrap(textureGrid, TEXTURE_WRAP_CLAMP);
// Setup player 1 camera and screen // Setup player 1 camera and screen
cameraPlayer1.fovy = 45.0f; cameraPlayer1.fovy = 45.0f;
cameraPlayer1.up.y = 1.0f; cameraPlayer1.up.y = 1.0f;
@ -151,7 +143,6 @@ int main(void)
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadRenderTexture(screenPlayer1); // Unload render texture UnloadRenderTexture(screenPlayer1); // Unload render texture
UnloadRenderTexture(screenPlayer2); // Unload render texture UnloadRenderTexture(screenPlayer2); // Unload render texture
UnloadTexture(textureGrid); // Unload texture
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------