Renamed some functions
- Renamed Begin3dMode() --> BeginMode3D() - Renamed Begin2dMode() --> BeginMode2D() - Renamed End3dMode() --> EndMode3D() - Renamed End2dMode() --> EndMode2D()
This commit is contained in:
parent
6324697ffd
commit
6045062a05
@ -97,7 +97,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin2dMode(camera);
|
||||
BeginMode2D(camera);
|
||||
|
||||
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
|
||||
|
||||
@ -108,7 +108,7 @@ int main()
|
||||
DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN);
|
||||
DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN);
|
||||
|
||||
End2dMode();
|
||||
EndMode2D();
|
||||
|
||||
DrawText("SCREEN AREA", 640, 10, 20, RED);
|
||||
|
||||
|
@ -61,7 +61,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
|
||||
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
|
||||
@ -75,7 +75,7 @@ int main()
|
||||
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
|
||||
}
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f));
|
||||
DrawRectangleLines( 10, 10, 220, 70, BLUE);
|
||||
|
@ -50,14 +50,14 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
|
||||
DrawRectangleLines( 10, 10, 320, 133, BLUE);
|
||||
|
@ -46,14 +46,14 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
|
||||
|
||||
|
@ -63,7 +63,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
if (collision)
|
||||
{
|
||||
@ -81,7 +81,7 @@ int main()
|
||||
DrawRay(ray, MAROON);
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
||||
|
||||
|
@ -57,14 +57,14 @@ int main()
|
||||
|
||||
BeginVrDrawing();
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||
|
||||
DrawGrid(40, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
EndVrDrawing();
|
||||
|
||||
|
@ -54,14 +54,14 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, BLACK);
|
||||
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, GRAY);
|
||||
|
@ -51,13 +51,13 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
@ -87,7 +87,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
// Draw enemy-box
|
||||
DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY);
|
||||
@ -102,7 +102,7 @@ int main()
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Move player with cursors to collide", 220, 40, 20, GRAY);
|
||||
|
||||
|
@ -56,11 +56,11 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, mapPosition, 1.0f, WHITE);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
||||
DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
|
||||
|
@ -45,7 +45,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED);
|
||||
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD);
|
||||
@ -63,7 +63,7 @@ int main()
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
@ -53,13 +53,13 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, mapPosition, 1.0f, RED);
|
||||
|
||||
DrawGrid(20, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE);
|
||||
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN);
|
||||
|
@ -73,13 +73,13 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, Vector3Zero(), 1.0f, WHITE);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
@ -72,13 +72,13 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(models[currentModel], position, 1.0f, WHITE);
|
||||
|
||||
DrawGrid(10, 1.0);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawRectangle(30, 400, 310, 30, Fade(SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(30, 400, 310, 30, Fade(DARKBLUE, 0.5f));
|
||||
|
@ -120,7 +120,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
// Draw the tower
|
||||
DrawModel(tower, towerPos, 1.0, WHITE);
|
||||
@ -151,7 +151,7 @@ int main()
|
||||
|
||||
DrawGrid(100, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
// Draw some debug GUI text
|
||||
DrawText(FormatText("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
|
||||
|
@ -50,7 +50,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
||||
|
||||
@ -58,7 +58,7 @@ int main()
|
||||
|
||||
DrawGizmo(position); // Draw gizmo
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||
|
||||
|
@ -57,7 +57,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED);
|
||||
DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD);
|
||||
@ -75,7 +75,7 @@ int main()
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Press Spacebar to switch camera type", 10, GetScreenHeight() - 30, 20, DARKGRAY);
|
||||
|
||||
|
@ -60,13 +60,13 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
@ -137,12 +137,12 @@ int main()
|
||||
EndTextureMode();
|
||||
|
||||
// Draw 3D model (recomended to draw 3D always before 2D)
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(model, (Vector3){ 0, 6.0f, 0 }, 1.0f, WHITE); // Draw 3d model with texture
|
||||
DrawGrid(10, 10.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
// Draw 2D GUI stuff
|
||||
DrawAngleGauge(texAngleGauge, 80, 70, roll, "roll", RED);
|
||||
|
@ -151,14 +151,14 @@ int main()
|
||||
if (vrDeviceReady) BeginOculusDrawing();
|
||||
else BeginVrDrawing();
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||
|
||||
DrawGrid(40, 1.0f);
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
if (vrDeviceReady) EndOculusDrawing();
|
||||
else EndVrDrawing();
|
||||
|
@ -159,7 +159,7 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
||||
|
||||
@ -169,7 +169,7 @@ int main()
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||
|
||||
|
@ -85,13 +85,13 @@ int main()
|
||||
|
||||
BeginTextureMode(target); // Enable drawing to texture
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RED);
|
||||
|
||||
|
@ -66,13 +66,13 @@ int main()
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||
|
||||
|
@ -130,13 +130,13 @@ int main()
|
||||
|
||||
BeginTextureMode(target); // Enable drawing to texture
|
||||
|
||||
Begin3dMode(camera);
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
||||
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
EndMode3D();
|
||||
|
||||
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
||||
|
||||
|
12
src/core.c
12
src/core.c
@ -117,7 +117,7 @@
|
||||
#include <stdlib.h> // Required for: malloc(), free(), rand(), atexit()
|
||||
#include <stdint.h> // Required for: typedef unsigned long long int uint64_t, used by hi-res timer
|
||||
#include <time.h> // Required for: time() - Android/RPI hi-res timer (NOTE: Linux only!)
|
||||
#include <math.h> // Required for: tan() [Used in Begin3dMode() to set perspective]
|
||||
#include <math.h> // Required for: tan() [Used in BeginMode3D() to set perspective]
|
||||
#include <string.h> // Required for: strrchr(), strcmp()
|
||||
//#include <errno.h> // Macros for reporting and retrieving error conditions through error codes
|
||||
#include <ctype.h> // Required for: tolower() [Used in IsFileExtension()]
|
||||
@ -888,7 +888,7 @@ void EndDrawing(void)
|
||||
}
|
||||
|
||||
// Initialize 2D mode with custom camera (2D)
|
||||
void Begin2dMode(Camera2D camera)
|
||||
void BeginMode2D(Camera2D camera)
|
||||
{
|
||||
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
|
||||
|
||||
@ -906,7 +906,7 @@ void Begin2dMode(Camera2D camera)
|
||||
}
|
||||
|
||||
// Ends 2D mode with custom camera
|
||||
void End2dMode(void)
|
||||
void EndMode2D(void)
|
||||
{
|
||||
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
|
||||
|
||||
@ -914,7 +914,7 @@ void End2dMode(void)
|
||||
}
|
||||
|
||||
// Initializes 3D mode with custom camera (3D)
|
||||
void Begin3dMode(Camera camera)
|
||||
void BeginMode3D(Camera3D camera)
|
||||
{
|
||||
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
|
||||
|
||||
@ -954,7 +954,7 @@ void Begin3dMode(Camera camera)
|
||||
}
|
||||
|
||||
// Ends 3D mode and returns to default 2D orthographic mode
|
||||
void End3dMode(void)
|
||||
void EndMode3D(void)
|
||||
{
|
||||
rlglDraw(); // Process internal buffers (update + draw)
|
||||
|
||||
@ -2912,7 +2912,7 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
||||
rlLoadIdentity(); // Reset current matrix (MODELVIEW)
|
||||
rlClearScreenBuffers(); // Clear screen buffers (color and depth)
|
||||
|
||||
// Window size must be updated to be used on 3D mode to get new aspect ratio (Begin3dMode())
|
||||
// Window size must be updated to be used on 3D mode to get new aspect ratio (BeginMode3D())
|
||||
// NOTE: Be careful! GLFW3 will choose the closest fullscreen resolution supported by current monitor,
|
||||
// for example, if reescaling back to 800x450 (desired), it could set 720x480 (closest fullscreen supported)
|
||||
screenWidth = width;
|
||||
|
10
src/raylib.h
10
src/raylib.h
@ -6,7 +6,7 @@
|
||||
* - Written in plain C code (C99) in PascalCase/camelCase notation
|
||||
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2 - choose at compile)
|
||||
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
|
||||
* - Powerful fonts module with SpriteFonts support (XNA fonts, AngelCode fonts, TTF)
|
||||
* - Powerful fonts module with Fonts support (XNA fonts, AngelCode fonts, TTF)
|
||||
* - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
|
||||
* - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
|
||||
* - Flexible Materials system, supporting classic maps and PBR maps
|
||||
@ -728,10 +728,10 @@ RLAPI void DisableCursor(void); // Disables cu
|
||||
RLAPI void ClearBackground(Color color); // Set background color (framebuffer clear color)
|
||||
RLAPI void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
|
||||
RLAPI void EndDrawing(void); // End canvas drawing and swap buffers (double buffering)
|
||||
RLAPI void Begin2dMode(Camera2D camera); // Initialize 2D mode with custom camera (2D)
|
||||
RLAPI void End2dMode(void); // Ends 2D mode with custom camera
|
||||
RLAPI void Begin3dMode(Camera camera); // Initializes 3D mode with custom camera (3D)
|
||||
RLAPI void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode
|
||||
RLAPI void BeginMode2D(Camera2D camera); // Initialize 2D mode with custom camera (2D)
|
||||
RLAPI void EndMode2D(void); // Ends 2D mode with custom camera
|
||||
RLAPI void BeginMode3D(Camera3D camera); // Initializes 3D mode with custom camera (3D)
|
||||
RLAPI void EndMode3D(void); // Ends 3D mode and returns to default 2D orthographic mode
|
||||
RLAPI void BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing
|
||||
RLAPI void EndTextureMode(void); // Ends drawing to render texture
|
||||
|
||||
|
@ -1947,7 +1947,7 @@ void rlDrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||
if (material.shader.locs[LOC_MATRIX_PROJECTION] != -1) SetShaderValueMatrix(material.shader, material.shader.locs[LOC_MATRIX_PROJECTION], projection);
|
||||
|
||||
// At this point the modelview matrix just contains the view matrix (camera)
|
||||
// That's because Begin3dMode() sets it an no model-drawing function modifies it, all use rlPushMatrix() and rlPopMatrix()
|
||||
// That's because BeginMode3D() sets it an no model-drawing function modifies it, all use rlPushMatrix() and rlPopMatrix()
|
||||
Matrix matView = modelview; // View matrix (camera)
|
||||
Matrix matProjection = projection; // Projection matrix (perspective)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user