Rest of shapes draw functions.
This commit is contained in:
228
API.md
228
API.md
@@ -1335,6 +1335,14 @@ Set target FPS ( maximum )
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> FPS = RL_GetFPS()
|
||||||
|
|
||||||
|
Get current FPS
|
||||||
|
|
||||||
|
- Success return int
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> delta = RL_GetFrameTime()
|
> delta = RL_GetFrameTime()
|
||||||
|
|
||||||
Get time in seconds for last frame drawn ( Delta time )
|
Get time in seconds for last frame drawn ( Delta time )
|
||||||
@@ -2274,7 +2282,7 @@ Set camera projection mode ( CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC )
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> success = RL_SetCamera3DMode( camera3D camera, int mode )
|
> success = RL_SetCameraMode( camera3D camera, int mode )
|
||||||
|
|
||||||
Set camera mode ( CAMERA_CUSTOM, CAMERA_FREE, CAMERA_ORBITAL... )
|
Set camera mode ( CAMERA_CUSTOM, CAMERA_FREE, CAMERA_ORBITAL... )
|
||||||
|
|
||||||
@@ -2444,6 +2452,17 @@ Get the world space position for a 2d camera screen space position
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> success = RL_SetShapesTexture( Texture2D texture, Rectangle source )
|
||||||
|
|
||||||
|
Set texture and rectangle to be used on shapes drawing
|
||||||
|
NOTE: It can be useful when using basic shapes and one single font,
|
||||||
|
defining a font char white rectangle would allow drawing everything in a single draw call
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> success = RL_DrawPixel( Vector2 pos, Color color )
|
> success = RL_DrawPixel( Vector2 pos, Color color )
|
||||||
|
|
||||||
Draw a pixel
|
Draw a pixel
|
||||||
@@ -2462,6 +2481,42 @@ Draw a line defining thickness
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, float thickness, Color color )
|
||||||
|
|
||||||
|
Draw a line using cubic-bezier curves in-out
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thickness, Color color )
|
||||||
|
|
||||||
|
Draw line using quadratic bezier curves with a control point
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawLineBezierCubic( Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thickness, Color color )
|
||||||
|
|
||||||
|
Draw line using quadratic bezier curves with a control point
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawLineStrip( Vector2 points{}, int pointsCount, Color color )
|
||||||
|
|
||||||
|
Draw lines sequence
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> success = RL_DrawCircle( Vector2 center, float radius, Color color )
|
> success = RL_DrawCircle( Vector2 center, float radius, Color color )
|
||||||
|
|
||||||
Draw a color-filled circle
|
Draw a color-filled circle
|
||||||
@@ -2471,6 +2526,33 @@ Draw a color-filled circle
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw a piece of a circle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw circle sector outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawCircleGradient( Vector2 center, float radius, Color color1, Color color2 )
|
||||||
|
|
||||||
|
Draw a gradient-filled circle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> success = RL_DrawCircleLines( Vector2 center, float radius, Color color )
|
> success = RL_DrawCircleLines( Vector2 center, float radius, Color color )
|
||||||
|
|
||||||
Draw circle outline
|
Draw circle outline
|
||||||
@@ -2480,6 +2562,42 @@ Draw circle outline
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawEllipse( Vector2 center, float radiusH, float radiusV, Color color )
|
||||||
|
|
||||||
|
Draw ellipse
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawEllipseLines( Vector2 center, float radiusH, float radiusV, Color color )
|
||||||
|
|
||||||
|
Draw ellipse outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw ring
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw ring outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> success = RL_DrawRectangle( Rectangle rec, Color color )
|
> success = RL_DrawRectangle( Rectangle rec, Color color )
|
||||||
|
|
||||||
Draw a color-filled rectangle
|
Draw a color-filled rectangle
|
||||||
@@ -2498,6 +2616,69 @@ Draw a color-filled rectangle with pro parameters
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRectangleGradientV( Rectangle rectangle, Color color1, Color color2 )
|
||||||
|
|
||||||
|
Draw a vertical-gradient-filled rectangle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRectangleGradientH( Rectangle rectangle, Color color1, Color color2 )
|
||||||
|
|
||||||
|
Draw a horizontal-gradient-filled rectangle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRectangleGradientEx( Rectangle rectangle, Color col1, Color col2, Color col3, Color col4 )
|
||||||
|
|
||||||
|
Draw a gradient-filled rectangle with custom vertex colors
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRectangleLines( Rectangle rec, Color color )
|
||||||
|
|
||||||
|
Draw rectangle outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRectangleLinesEx( Rectangle rec, int lineThick, Color color )
|
||||||
|
|
||||||
|
Draw rectangle outline with extended parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRectangleRounded( Rectangle rec, float roundness, int segments, Color color )
|
||||||
|
|
||||||
|
Draw rectangle with rounded edges
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color )
|
||||||
|
|
||||||
|
Draw rectangle with rounded edges outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
> success = RL_DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color )
|
> success = RL_DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color )
|
||||||
|
|
||||||
Draw a color-filled triangle ( Vertex in counter-clockwise order! )
|
Draw a color-filled triangle ( Vertex in counter-clockwise order! )
|
||||||
@@ -2516,6 +2697,51 @@ Draw triangle outline ( Vertex in counter-clockwise order! )
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawTriangleFan( Vector2 points{}, int pointsCount, Color color )
|
||||||
|
|
||||||
|
Draw a triangle fan defined by points ( first vertex is the center )
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawTriangleStrip( Vector2 points{}, int pointsCount, Color color )
|
||||||
|
|
||||||
|
Draw a triangle strip defined by points
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawPoly( Vector2 center, int sides, float radius, float rotation, Color color )
|
||||||
|
|
||||||
|
Draw a regular polygon ( Vector version )
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawPolyLines( Vector2 center, int sides, float radius, float rotation, Color color )
|
||||||
|
|
||||||
|
Draw a polygon outline of n sides
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL_DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color )
|
||||||
|
|
||||||
|
Draw a polygon outline of n sides with extended parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Shapes - Collision
|
## Shapes - Collision
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function init()
|
|||||||
RL_SetCamera3DPosition( camera, pos )
|
RL_SetCamera3DPosition( camera, pos )
|
||||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||||
RL_SetCamera3DMode( camera, CAMERA_FIRST_PERSON )
|
RL_SetCameraMode( camera, CAMERA_FIRST_PERSON )
|
||||||
|
|
||||||
-- for x = 0, 3 do
|
-- for x = 0, 3 do
|
||||||
-- for y = 0, 9 do
|
-- for y = 0, 9 do
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function init()
|
|||||||
RL_SetCamera3DPosition( camera, { 0, 8, 16 } )
|
RL_SetCamera3DPosition( camera, { 0, 8, 16 } )
|
||||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||||
RL_SetCamera3DMode( camera, CAMERA_FREE )
|
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||||
|
|
||||||
heigthImage = RL_LoadImage( RL_GetBasePath().."../resources/images/heightmap.png" )
|
heigthImage = RL_LoadImage( RL_GetBasePath().."../resources/images/heightmap.png" )
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function init()
|
|||||||
RL_SetCamera3DPosition( camera, { 0, 2, 4 } )
|
RL_SetCamera3DPosition( camera, { 0, 2, 4 } )
|
||||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||||
RL_SetCamera3DMode( camera, CAMERA_FREE )
|
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||||
|
|
||||||
material = RL_CreateMaterial( {
|
material = RL_CreateMaterial( {
|
||||||
maps = {
|
maps = {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function init()
|
|||||||
RL_SetCamera3DPosition( camera, { 0, 8, 16 } )
|
RL_SetCamera3DPosition( camera, { 0, 8, 16 } )
|
||||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||||
RL_SetCamera3DMode( camera, CAMERA_FREE )
|
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||||
|
|
||||||
local ts = PLANE_SIZE
|
local ts = PLANE_SIZE
|
||||||
local meshData = {
|
local meshData = {
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ function init()
|
|||||||
local mSize = RL_GetMonitorSize( monitor )
|
local mSize = RL_GetMonitorSize( monitor )
|
||||||
local winSize = { 1920, 1080 }
|
local winSize = { 1920, 1080 }
|
||||||
|
|
||||||
|
RL_SetConfigFlags( FLAG_VSYNC_HINT )
|
||||||
|
|
||||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||||
RL_SetWindowSize( winSize )
|
RL_SetWindowSize( winSize )
|
||||||
@@ -41,7 +43,7 @@ function init()
|
|||||||
RL_SetCamera3DPosition( camera, { 0, 1, 2 } )
|
RL_SetCamera3DPosition( camera, { 0, 1, 2 } )
|
||||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||||
RL_SetCamera3DMode( camera, CAMERA_FREE )
|
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||||
|
|
||||||
calcNormal( tri )
|
calcNormal( tri )
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function init()
|
|||||||
RL_SetCamera3DPosition( camera, { 0, 2, 4 } )
|
RL_SetCamera3DPosition( camera, { 0, 2, 4 } )
|
||||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||||
RL_SetCamera3DMode( camera, CAMERA_FREE )
|
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||||
|
|
||||||
sphereMesh = RL_GenMeshSphere( 1.0, 8, 10 )
|
sphereMesh = RL_GenMeshSphere( 1.0, 8, 10 )
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ int lcoreSetClipboardText( lua_State *L );
|
|||||||
int lcoreGetClipboardText( lua_State *L );
|
int lcoreGetClipboardText( lua_State *L );
|
||||||
/* Timing. */
|
/* Timing. */
|
||||||
int lcoreSetTargetFPS( lua_State *L );
|
int lcoreSetTargetFPS( lua_State *L );
|
||||||
|
int lcoreGetFPS( lua_State *L );
|
||||||
int lcoreGetFrameTime( lua_State *L );
|
int lcoreGetFrameTime( lua_State *L );
|
||||||
int lcoreGetTime( lua_State *L );
|
int lcoreGetTime( lua_State *L );
|
||||||
/* Misc. */
|
/* Misc. */
|
||||||
@@ -117,7 +118,7 @@ int lcoreGetCamera3DUp( lua_State *L );
|
|||||||
int lcoreGetCamera3DFovy( lua_State *L );
|
int lcoreGetCamera3DFovy( lua_State *L );
|
||||||
int lcoreGetCamera3DProjection( lua_State *L );
|
int lcoreGetCamera3DProjection( lua_State *L );
|
||||||
int lcoreUpdateCamera3D( lua_State *L );
|
int lcoreUpdateCamera3D( lua_State *L );
|
||||||
int lcoreSetCamera3DMode( lua_State *L );
|
int lcoreSetCameraMode( lua_State *L );
|
||||||
int lcoreSetCameraPanControl( lua_State *L );
|
int lcoreSetCameraPanControl( lua_State *L );
|
||||||
int lcoreSetCameraAltControl( lua_State *L );
|
int lcoreSetCameraAltControl( lua_State *L );
|
||||||
int lcoreSetCameraSmoothZoomControl( lua_State *L );
|
int lcoreSetCameraSmoothZoomControl( lua_State *L );
|
||||||
|
|||||||
@@ -1,14 +1,38 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* Drawing. */
|
/* Drawing. */
|
||||||
|
int lshapesSetShapesTexture( lua_State *L );
|
||||||
int lshapesDrawPixel( lua_State *L );
|
int lshapesDrawPixel( lua_State *L );
|
||||||
int lshapesDrawLine( lua_State *L );
|
int lshapesDrawLine( lua_State *L );
|
||||||
|
int lshapesDrawLineBezier( lua_State *L );
|
||||||
|
int lshapesDrawLineBezierQuad( lua_State *L );
|
||||||
|
int lshapesDrawLineBezierCubic( lua_State *L );
|
||||||
|
int lshapesDrawLineStrip( lua_State *L );
|
||||||
int lshapesDrawCircle( lua_State *L );
|
int lshapesDrawCircle( lua_State *L );
|
||||||
|
int lshapesDrawCircleSector( lua_State *L );
|
||||||
|
int lshapesDrawCircleSectorLines( lua_State *L );
|
||||||
|
int lshapesDrawCircleGradient( lua_State *L );
|
||||||
int lshapesDrawCircleLines( lua_State *L );
|
int lshapesDrawCircleLines( lua_State *L );
|
||||||
|
int lshapesDrawEllipse( lua_State *L );
|
||||||
|
int lshapesDrawEllipseLines( lua_State *L );
|
||||||
|
int lshapesDrawRing( lua_State *L );
|
||||||
|
int lshapesDrawRingLines( lua_State *L );
|
||||||
int lshapesDrawRectangle( lua_State *L );
|
int lshapesDrawRectangle( lua_State *L );
|
||||||
int lshapesDrawRectanglePro( lua_State *L );
|
int lshapesDrawRectanglePro( lua_State *L );
|
||||||
|
int lshapesDrawRectangleGradientV( lua_State *L );
|
||||||
|
int lshapesDrawRectangleGradientH( lua_State *L );
|
||||||
|
int lshapesDrawRectangleGradientEx( lua_State *L );
|
||||||
|
int lshapesDrawRectangleLines( lua_State *L );
|
||||||
|
int lshapesDrawRectangleLinesEx( lua_State *L );
|
||||||
|
int lshapesDrawRectangleRounded( lua_State *L );
|
||||||
|
int lshapesDrawRectangleRoundedLines( lua_State *L );
|
||||||
int lshapesDrawTriangle( lua_State *L );
|
int lshapesDrawTriangle( lua_State *L );
|
||||||
int lshapesDrawTriangleLines( lua_State *L );
|
int lshapesDrawTriangleLines( lua_State *L );
|
||||||
|
int lshapesDrawTriangleFan( lua_State *L );
|
||||||
|
int lshapesDrawTriangleStrip( lua_State *L );
|
||||||
|
int lshapesDrawPoly( lua_State *L );
|
||||||
|
int lshapesDrawPolyLines( lua_State *L );
|
||||||
|
int lshapesDrawPolyLinesEx( lua_State *L );
|
||||||
/* Collision. */
|
/* Collision. */
|
||||||
int lshapesCheckCollisionRecs( lua_State *L );
|
int lshapesCheckCollisionRecs( lua_State *L );
|
||||||
int lshapesCheckCollisionCircles( lua_State *L );
|
int lshapesCheckCollisionCircles( lua_State *L );
|
||||||
|
|||||||
19
src/core.c
19
src/core.c
@@ -587,6 +587,19 @@ int lcoreSetTargetFPS( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> FPS = RL_GetFPS()
|
||||||
|
|
||||||
|
Get current FPS
|
||||||
|
|
||||||
|
- Success return int
|
||||||
|
*/
|
||||||
|
int lcoreGetFPS( lua_State *L ) {
|
||||||
|
lua_pushinteger( L, GetFPS() );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> delta = RL_GetFrameTime()
|
> delta = RL_GetFrameTime()
|
||||||
|
|
||||||
@@ -2804,16 +2817,16 @@ int lcoreSetCamera3DProjection( lua_State *L ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL_SetCamera3DMode( camera3D camera, int mode )
|
> success = RL_SetCameraMode( camera3D camera, int mode )
|
||||||
|
|
||||||
Set camera mode ( CAMERA_CUSTOM, CAMERA_FREE, CAMERA_ORBITAL... )
|
Set camera mode ( CAMERA_CUSTOM, CAMERA_FREE, CAMERA_ORBITAL... )
|
||||||
|
|
||||||
- Failure return false
|
- Failure return false
|
||||||
- Success return true
|
- Success return true
|
||||||
*/
|
*/
|
||||||
int lcoreSetCamera3DMode( lua_State *L ) {
|
int lcoreSetCameraMode( lua_State *L ) {
|
||||||
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
|
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
|
||||||
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetCamera3DMode( camera3D camera, int mode )" );
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetCameraMode( camera3D camera, int mode )" );
|
||||||
lua_pushboolean( L, false );
|
lua_pushboolean( L, false );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -685,6 +685,7 @@ void luaRegister() {
|
|||||||
lua_register( L, "RL_GetClipboardText", lcoreGetClipboardText );
|
lua_register( L, "RL_GetClipboardText", lcoreGetClipboardText );
|
||||||
/* Timing. */
|
/* Timing. */
|
||||||
lua_register( L, "RL_SetTargetFPS", lcoreSetTargetFPS );
|
lua_register( L, "RL_SetTargetFPS", lcoreSetTargetFPS );
|
||||||
|
lua_register( L, "RL_GetFPS", lcoreGetFPS );
|
||||||
lua_register( L, "RL_GetFrameTime", lcoreGetFrameTime );
|
lua_register( L, "RL_GetFrameTime", lcoreGetFrameTime );
|
||||||
lua_register( L, "RL_GetTime", lcoreGetTime );
|
lua_register( L, "RL_GetTime", lcoreGetTime );
|
||||||
/* Misc. */
|
/* Misc. */
|
||||||
@@ -767,7 +768,7 @@ void luaRegister() {
|
|||||||
lua_register( L, "RL_GetCamera3DFovy", lcoreGetCamera3DFovy );
|
lua_register( L, "RL_GetCamera3DFovy", lcoreGetCamera3DFovy );
|
||||||
lua_register( L, "RL_GetCamera3DProjection", lcoreGetCamera3DProjection );
|
lua_register( L, "RL_GetCamera3DProjection", lcoreGetCamera3DProjection );
|
||||||
lua_register( L, "RL_UpdateCamera3D", lcoreUpdateCamera3D );
|
lua_register( L, "RL_UpdateCamera3D", lcoreUpdateCamera3D );
|
||||||
lua_register( L, "RL_SetCamera3DMode", lcoreSetCamera3DMode );
|
lua_register( L, "RL_SetCameraMode", lcoreSetCameraMode );
|
||||||
lua_register( L, "RL_SetCameraPanControl", lcoreSetCameraPanControl );
|
lua_register( L, "RL_SetCameraPanControl", lcoreSetCameraPanControl );
|
||||||
lua_register( L, "RL_SetCameraAltControl", lcoreSetCameraAltControl );
|
lua_register( L, "RL_SetCameraAltControl", lcoreSetCameraAltControl );
|
||||||
lua_register( L, "RL_SetCameraSmoothZoomControl", lcoreSetCameraSmoothZoomControl );
|
lua_register( L, "RL_SetCameraSmoothZoomControl", lcoreSetCameraSmoothZoomControl );
|
||||||
@@ -824,14 +825,38 @@ void luaRegister() {
|
|||||||
|
|
||||||
/* Shapes. */
|
/* Shapes. */
|
||||||
/* Drawing. */
|
/* Drawing. */
|
||||||
|
lua_register( L, "RL_SetShapesTexture", lshapesSetShapesTexture );
|
||||||
lua_register( L, "RL_DrawPixel", lshapesDrawPixel );
|
lua_register( L, "RL_DrawPixel", lshapesDrawPixel );
|
||||||
lua_register( L, "RL_DrawLine", lshapesDrawLine );
|
lua_register( L, "RL_DrawLine", lshapesDrawLine );
|
||||||
|
lua_register( L, "RL_DrawLineBezier", lshapesDrawLineBezier );
|
||||||
|
lua_register( L, "RL_DrawLineBezierQuad", lshapesDrawLineBezierQuad );
|
||||||
|
lua_register( L, "RL_DrawLineBezierCubic", lshapesDrawLineBezierCubic );
|
||||||
|
lua_register( L, "RL_DrawLineStrip", lshapesDrawLineStrip );
|
||||||
lua_register( L, "RL_DrawCircle", lshapesDrawCircle );
|
lua_register( L, "RL_DrawCircle", lshapesDrawCircle );
|
||||||
|
lua_register( L, "RL_DrawCircleSector", lshapesDrawCircleSector );
|
||||||
|
lua_register( L, "RL_DrawCircleSectorLines", lshapesDrawCircleSectorLines );
|
||||||
|
lua_register( L, "RL_DrawCircleGradient", lshapesDrawCircleGradient );
|
||||||
lua_register( L, "RL_DrawCircleLines", lshapesDrawCircleLines );
|
lua_register( L, "RL_DrawCircleLines", lshapesDrawCircleLines );
|
||||||
|
lua_register( L, "RL_DrawEllipse", lshapesDrawEllipse );
|
||||||
|
lua_register( L, "RL_DrawEllipseLines", lshapesDrawEllipseLines );
|
||||||
|
lua_register( L, "RL_DrawRing", lshapesDrawRing );
|
||||||
|
lua_register( L, "RL_DrawRingLines", lshapesDrawRingLines );
|
||||||
lua_register( L, "RL_DrawRectangle", lshapesDrawRectangle );
|
lua_register( L, "RL_DrawRectangle", lshapesDrawRectangle );
|
||||||
lua_register( L, "RL_DrawRectanglePro", lshapesDrawRectanglePro );
|
lua_register( L, "RL_DrawRectanglePro", lshapesDrawRectanglePro );
|
||||||
|
lua_register( L, "RL_DrawRectangleGradientV", lshapesDrawRectangleGradientV );
|
||||||
|
lua_register( L, "RL_DrawRectangleGradientH", lshapesDrawRectangleGradientH );
|
||||||
|
lua_register( L, "RL_DrawRectangleGradientEx", lshapesDrawRectangleGradientEx );
|
||||||
|
lua_register( L, "RL_DrawRectangleLines", lshapesDrawRectangleLines );
|
||||||
|
lua_register( L, "RL_DrawRectangleLinesEx", lshapesDrawRectangleLinesEx );
|
||||||
|
lua_register( L, "RL_DrawRectangleRounded", lshapesDrawRectangleRounded );
|
||||||
|
lua_register( L, "RL_DrawRectangleRoundedLines", lshapesDrawRectangleRoundedLines );
|
||||||
lua_register( L, "RL_DrawTriangle", lshapesDrawTriangle );
|
lua_register( L, "RL_DrawTriangle", lshapesDrawTriangle );
|
||||||
lua_register( L, "RL_DrawTriangleLines", lshapesDrawTriangleLines );
|
lua_register( L, "RL_DrawTriangleLines", lshapesDrawTriangleLines );
|
||||||
|
lua_register( L, "RL_DrawTriangleFan", lshapesDrawTriangleFan );
|
||||||
|
lua_register( L, "RL_DrawTriangleStrip", lshapesDrawTriangleStrip );
|
||||||
|
lua_register( L, "RL_DrawPoly", lshapesDrawPoly );
|
||||||
|
lua_register( L, "RL_DrawPolyLines", lshapesDrawPolyLines );
|
||||||
|
lua_register( L, "RL_DrawPolyLinesEx", lshapesDrawPolyLinesEx );
|
||||||
/* Collision. */
|
/* Collision. */
|
||||||
lua_register( L, "RL_CheckCollisionRecs", lshapesCheckCollisionRecs );
|
lua_register( L, "RL_CheckCollisionRecs", lshapesCheckCollisionRecs );
|
||||||
lua_register( L, "RL_CheckCollisionCircles", lshapesCheckCollisionCircles );
|
lua_register( L, "RL_CheckCollisionCircles", lshapesCheckCollisionCircles );
|
||||||
|
|||||||
@@ -2140,7 +2140,6 @@ int lmodelsUpdateModelAnimation( lua_State *L ) {
|
|||||||
lua_pushboolean( L, false );
|
lua_pushboolean( L, false );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateModelAnimation( *state->models[ modelId ], state->animations[ animId ]->animations[ lua_tointeger( L, -2 ) ], frame );
|
UpdateModelAnimation( *state->models[ modelId ], state->animations[ animId ]->animations[ lua_tointeger( L, -2 ) ], frame );
|
||||||
lua_pushboolean( L, true );
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
|||||||
740
src/shapes.c
740
src/shapes.c
@@ -1,11 +1,42 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "shapes.h"
|
#include "shapes.h"
|
||||||
#include "lua_core.h"
|
#include "lua_core.h"
|
||||||
|
#include "textures.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
## Shapes - Drawing
|
## Shapes - Drawing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_SetShapesTexture( Texture2D texture, Rectangle source )
|
||||||
|
|
||||||
|
Set texture and rectangle to be used on shapes drawing
|
||||||
|
NOTE: It can be useful when using basic shapes and one single font,
|
||||||
|
defining a font char white rectangle would allow drawing everything in a single draw call
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesSetShapesTexture( lua_State *L ) {
|
||||||
|
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetShapesTexture( Texture2D texture, Rectangle source )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Rectangle source = uluaGetRectangle( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
size_t texId = lua_tointeger( L, -1 );
|
||||||
|
|
||||||
|
if ( !validSourceTexture( texId ) ) {
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
SetShapesTexture( *texturesGetSourceTexture( texId ), source );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL_DrawPixel( Vector2 pos, Color color )
|
> success = RL_DrawPixel( Vector2 pos, Color color )
|
||||||
|
|
||||||
@@ -58,6 +89,133 @@ int lshapesDrawLine( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, float thickness, Color color )
|
||||||
|
|
||||||
|
Draw a line using cubic-bezier curves in-out
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawLineBezier( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, float thickness, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float thickness = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 endPos = uluaGetVector2( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 startPos = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawLineBezier( startPos, endPos, thickness, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thickness, Color color )
|
||||||
|
|
||||||
|
Draw line using quadratic bezier curves with a control point
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawLineBezierQuad( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thickness, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float thickness = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 controlPos = uluaGetVector2( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 endPos = uluaGetVector2( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 startPos = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawLineBezierQuad( startPos, endPos, controlPos, thickness, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawLineBezierCubic( Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thickness, Color color )
|
||||||
|
|
||||||
|
Draw line using quadratic bezier curves with a control point
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawLineBezierCubic( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -6 ) || !lua_istable( L, -5 ) || !lua_istable( L, -4 ) ||
|
||||||
|
!lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineBezierCubic( Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thickness, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float thickness = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 endControlPos = uluaGetVector2( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 startControlPos = uluaGetVector2( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 endPos = uluaGetVector2( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 startPos = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawLineBezierCubic( startPos, endPos, startControlPos, endControlPos, thickness, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawLineStrip( Vector2 points{}, int pointsCount, Color color )
|
||||||
|
|
||||||
|
Draw lines sequence
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawLineStrip( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineStrip( Vector2 points{}, int pointsCount, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int pointsCount = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 points[ pointsCount ];
|
||||||
|
|
||||||
|
int t = lua_gettop( L );
|
||||||
|
int i = 0;
|
||||||
|
lua_pushnil( L );
|
||||||
|
|
||||||
|
while ( lua_next( L, t ) != 0 ) {
|
||||||
|
points[i] = uluaGetVector2( L );
|
||||||
|
i++;
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawLineStrip( points, pointsCount, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL_DrawCircle( Vector2 center, float radius, Color color )
|
> success = RL_DrawCircle( Vector2 center, float radius, Color color )
|
||||||
|
|
||||||
@@ -84,6 +242,100 @@ int lshapesDrawCircle( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw a piece of a circle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawCircleSector( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
|
||||||
|
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int segments = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float endAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float startAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawCircleSector( center, radius, startAngle, endAngle, segments, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw circle sector outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawCircleSectorLines( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
|
||||||
|
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int segments = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float endAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float startAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawCircleSectorLines( center, radius, startAngle, endAngle, segments, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawCircleGradient( Vector2 center, float radius, Color color1, Color color2 )
|
||||||
|
|
||||||
|
Draw a gradient-filled circle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawCircleGradient( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircleGradient( Vector2 center, float radius, Color color1, Color color2 )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color2 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Color color1 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawCircleGradient( center.x, center.y, radius, color1, color2 );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL_DrawCircleLines( Vector2 center, float radius, Color color )
|
> success = RL_DrawCircleLines( Vector2 center, float radius, Color color )
|
||||||
|
|
||||||
@@ -110,6 +362,132 @@ int lshapesDrawCircleLines( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawEllipse( Vector2 center, float radiusH, float radiusV, Color color )
|
||||||
|
|
||||||
|
Draw ellipse
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawEllipse( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawEllipse( Vector2 center, float radiusH, float radiusV, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radiusV = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radiusH = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawEllipse( center.x, center.y, radiusH, radiusV, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawEllipseLines( Vector2 center, float radiusH, float radiusV, Color color )
|
||||||
|
|
||||||
|
Draw ellipse outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawEllipseLines( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawEllipseLines( Vector2 center, float radiusH, float radiusV, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radiusV = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radiusH = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawEllipseLines( center.x, center.y, radiusH, radiusV, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw ring
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRing( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -7 ) || !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
|
||||||
|
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int segments = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float endAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float startAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float outerRadius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float innerRadius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawRing( center, innerRadius, outerRadius, startAngle, endAngle, segments, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )
|
||||||
|
|
||||||
|
Draw ring outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRingLines( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -7 ) || !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
|
||||||
|
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int segments = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float endAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float startAngle = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float outerRadius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float innerRadius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawRingLines( center, innerRadius, outerRadius, startAngle, endAngle, segments, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL_DrawRectangle( Rectangle rec, Color color )
|
> success = RL_DrawRectangle( Rectangle rec, Color color )
|
||||||
|
|
||||||
@@ -124,12 +502,9 @@ int lshapesDrawRectangle( lua_State *L ) {
|
|||||||
lua_pushboolean( L, false );
|
lua_pushboolean( L, false );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Rectangle rect = { 0, 0, 0, 0 };
|
Color color = uluaGetColor( L );
|
||||||
Color color = { 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
color = uluaGetColor( L );
|
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
rect = uluaGetRectangle( L );
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
DrawRectangleRec( rect, color );
|
DrawRectangleRec( rect, color );
|
||||||
lua_pushboolean( L, true );
|
lua_pushboolean( L, true );
|
||||||
@@ -165,6 +540,196 @@ int lshapesDrawRectanglePro( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRectangleGradientV( Rectangle rectangle, Color color1, Color color2 )
|
||||||
|
|
||||||
|
Draw a vertical-gradient-filled rectangle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRectangleGradientV( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleGradientV( Rectangle rectangle, Color color1, Color color2 )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color2 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Color color1 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
|
DrawRectangleGradientV( rect.x, rect.y, rect.width, rect.height, color1, color2 );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRectangleGradientH( Rectangle rectangle, Color color1, Color color2 )
|
||||||
|
|
||||||
|
Draw a horizontal-gradient-filled rectangle
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRectangleGradientH( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleGradientH( Rectangle rectangle, Color color1, Color color2 )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color2 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Color color1 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
|
DrawRectangleGradientH( rect.x, rect.y, rect.width, rect.height, color1, color2 );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRectangleGradientEx( Rectangle rectangle, Color col1, Color col2, Color col3, Color col4 )
|
||||||
|
|
||||||
|
Draw a gradient-filled rectangle with custom vertex colors
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRectangleGradientEx( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleGradientEx( Rectangle rectangle, Color col1, Color col2, Color col3, Color col4 )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color4 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Color color3 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Color color2 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Color color1 = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
|
DrawRectangleGradientEx( rect, color1, color2, color3, color4 );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRectangleLines( Rectangle rec, Color color )
|
||||||
|
|
||||||
|
Draw rectangle outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRectangleLines( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangle( Rectangle rec, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
|
DrawRectangleLines( rect.x, rect.y, rect.width, rect.height, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRectangleLinesEx( Rectangle rec, int lineThick, Color color )
|
||||||
|
|
||||||
|
Draw rectangle outline with extended parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRectangleLinesEx( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleLinesEx( Rectangle rec, int lineThick, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int lineThick = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
|
DrawRectangleLinesEx( rect, lineThick, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRectangleRounded( Rectangle rec, float roundness, int segments, Color color )
|
||||||
|
|
||||||
|
Draw rectangle with rounded edges
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRectangleRounded( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleRounded( Rectangle rec, float roundness, int segments, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int segments = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float roundness = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
|
DrawRectangleRounded( rect, roundness, segments, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color )
|
||||||
|
|
||||||
|
Draw rectangle with rounded edges outline
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawRectangleRoundedLines( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int lineThick = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int segments = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float roundness = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Rectangle rect = uluaGetRectangle( L );
|
||||||
|
|
||||||
|
DrawRectangleRoundedLines( rect, roundness, segments, lineThick, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
> success = RL_DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color )
|
> success = RL_DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color )
|
||||||
|
|
||||||
@@ -221,6 +786,171 @@ int lshapesDrawTriangleLines( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawTriangleFan( Vector2 points{}, int pointsCount, Color color )
|
||||||
|
|
||||||
|
Draw a triangle fan defined by points ( first vertex is the center )
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawTriangleFan( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawTriangleFan( Vector2 points{}, int pointsCount, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int pointsCount = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 points[ pointsCount ];
|
||||||
|
|
||||||
|
int t = lua_gettop( L );
|
||||||
|
int i = 0;
|
||||||
|
lua_pushnil( L );
|
||||||
|
|
||||||
|
while ( lua_next( L, t ) != 0 ) {
|
||||||
|
points[i] = uluaGetVector2( L );
|
||||||
|
i++;
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawTriangleFan( points, pointsCount, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawTriangleStrip( Vector2 points{}, int pointsCount, Color color )
|
||||||
|
|
||||||
|
Draw a triangle strip defined by points
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawTriangleStrip( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawTriangleStrip( Vector2 points{}, int pointsCount, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int pointsCount = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 points[ pointsCount ];
|
||||||
|
|
||||||
|
int t = lua_gettop( L );
|
||||||
|
int i = 0;
|
||||||
|
lua_pushnil( L );
|
||||||
|
|
||||||
|
while ( lua_next( L, t ) != 0 ) {
|
||||||
|
points[i] = uluaGetVector2( L );
|
||||||
|
i++;
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawTriangleStrip( points, pointsCount, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawPoly( Vector2 center, int sides, float radius, float rotation, Color color )
|
||||||
|
|
||||||
|
Draw a regular polygon ( Vector version )
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawPoly( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawPoly( Vector2 center, int sides, float radius, float rotation, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float rotation = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int sides = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawPoly( center, sides, radius, rotation, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawPolyLines( Vector2 center, int sides, float radius, float rotation, Color color )
|
||||||
|
|
||||||
|
Draw a polygon outline of n sides
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawPolyLines( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawPolyLines( Vector2 center, int sides, float radius, float rotation, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float rotation = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int sides = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawPolyLines( center, sides, radius, rotation, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL_DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color )
|
||||||
|
|
||||||
|
Draw a polygon outline of n sides with extended parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lshapesDrawPolyLinesEx( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
|
||||||
|
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Color color = uluaGetColor( L );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float lineThick = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float rotation = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
float radius = lua_tonumber( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
int sides = lua_tointeger( L, -1 );
|
||||||
|
lua_pop( L, 1 );
|
||||||
|
Vector2 center = uluaGetVector2( L );
|
||||||
|
|
||||||
|
DrawPolyLinesEx( center, sides, radius, rotation, lineThick, color );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
## Shapes - Collision
|
## Shapes - Collision
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user