RLGL line width functions.
This commit is contained in:
26
API.md
26
API.md
@@ -955,7 +955,7 @@ OpenGL style 4x4. Identity matrix example
|
||||
|
||||
> Rectangle = { 0.0, 0.0, 1.0, 1.0 } or { x = 0.0, y = 0.0, width = 1.0, height = 1.0 }
|
||||
|
||||
{ x, y, w ,h }. Rectangle type
|
||||
{ x, y, width ,height }. Rectangle type
|
||||
|
||||
---
|
||||
|
||||
@@ -2264,7 +2264,7 @@ Set camera up vector ( Rotation over it's axis )
|
||||
|
||||
---
|
||||
|
||||
> success = RL_SetCamera3DFovy( camera3D camera, Vector3 fovy )
|
||||
> success = RL_SetCamera3DFovy( camera3D camera, float fovy )
|
||||
|
||||
Set camera field-of-view apperture in Y ( degrees ) in perspective, used as near plane width in orthographic
|
||||
|
||||
@@ -4018,6 +4018,7 @@ Draw a 3d mesh with material and transform
|
||||
> success = RL_DrawMeshInstanced( Mesh mesh, Material material, Matrix{} transforms, int instances )
|
||||
|
||||
Draw multiple mesh instances with material and different transforms
|
||||
Note! Untested.
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
@@ -6015,3 +6016,24 @@ Send light properties to shader
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
## RLGL - General render state
|
||||
|
||||
---
|
||||
|
||||
> success = RL_rlSetLineWidth( float width )
|
||||
|
||||
Set the line drawing width
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> width = RL_rlGetLineWidth()
|
||||
|
||||
Get the line drawing width
|
||||
|
||||
- Success return float
|
||||
|
||||
---
|
||||
|
||||
@@ -83,7 +83,7 @@ OpenGL style 4x4. Identity matrix example\n\n---\n" )
|
||||
apiFile:write( "\n> Color = { 255, 255, 255, 255 } or { r = 255, g = 255, b = 255, a = 255 }\n\
|
||||
{ r, g, b ,a }. Color type, RGBA (32bit)\n\n---\n" )
|
||||
apiFile:write( "\n> Rectangle = { 0.0, 0.0, 1.0, 1.0 } or { x = 0.0, y = 0.0, width = 1.0, height = 1.0 }\n\
|
||||
{ x, y, w ,h }. Rectangle type\n\n---\n" )
|
||||
{ x, y, width ,height }. Rectangle type\n\n---\n" )
|
||||
apiFile:write( "\n> Image = ImageId\n\
|
||||
int id. Image type (multiple pixel formats supported). NOTE: Data stored in CPU memory (RAM)\n\n---\n" )
|
||||
apiFile:write( "\n> Texture = TextureId\n\
|
||||
@@ -154,6 +154,7 @@ local sourceFiles = {
|
||||
"src/rmath.c",
|
||||
"src/rgui.c",
|
||||
"src/lights.c",
|
||||
"src/rlgl.c",
|
||||
}
|
||||
|
||||
for _, src in ipairs( sourceFiles ) do
|
||||
|
||||
@@ -84,6 +84,7 @@ function init()
|
||||
local monitorPos = Vec2:new( RL_GetMonitorPosition( monitor ) )
|
||||
local monitorSize = Vec2:new( RL_GetMonitorSize( monitor ) )
|
||||
|
||||
RL_SetConfigFlags( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowTitle( "Platformer" )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowSize( winSize )
|
||||
@@ -121,6 +122,7 @@ local function tileCollision( entity )
|
||||
if isTileWall( Vec2:new( tileRect[3], y ) ) then
|
||||
-- Use new_x to push out of tile.
|
||||
local new_x = tileRect[3] * TILE_SIZE - ( entity.colRect[1] + entity.colRect[3] )
|
||||
|
||||
entity.vel.x = new_x - tinyGap
|
||||
|
||||
break
|
||||
@@ -128,7 +130,7 @@ local function tileCollision( entity )
|
||||
elseif entity.vel.x < 0 then
|
||||
if isTileWall( Vec2:new( tileRect[1], y ) ) then
|
||||
local new_x = ( tileRect[1] * TILE_SIZE + TILE_SIZE ) - entity.colRect[1]
|
||||
entity.vel.x = new_x + tinyGap, 0
|
||||
entity.vel.x = new_x + tinyGap
|
||||
|
||||
break
|
||||
end
|
||||
|
||||
5
include/lrlgl.h
Normal file
5
include/lrlgl.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
/* General render state. */
|
||||
int lrlglSetLineWidth( lua_State *L );
|
||||
int lrlglGetLineWidth( lua_State *L );
|
||||
@@ -2763,7 +2763,7 @@ int lcoreSetCamera3DUp( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> success = RL_SetCamera3DFovy( camera3D camera, Vector3 fovy )
|
||||
> success = RL_SetCamera3DFovy( camera3D camera, float fovy )
|
||||
|
||||
Set camera field-of-view apperture in Y ( degrees ) in perspective, used as near plane width in orthographic
|
||||
|
||||
@@ -2772,7 +2772,7 @@ Set camera field-of-view apperture in Y ( degrees ) in perspective, used as near
|
||||
*/
|
||||
int lcoreSetCamera3DFovy( lua_State *L ) {
|
||||
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
|
||||
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetCamera3DFovy( camera3D camera, Vector3 fovy )" );
|
||||
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetCamera3DFovy( camera3D camera, float fovy )" );
|
||||
lua_pushboolean( L, false );
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "rmath.h"
|
||||
#include "rgui.h"
|
||||
#include "lights.h"
|
||||
#include "lrlgl.h"
|
||||
|
||||
static void assignGlobalInt( int value, const char *name ) {
|
||||
lua_State *L = state->luaState;
|
||||
@@ -1257,6 +1258,10 @@ void luaRegister() {
|
||||
/* Basics. */
|
||||
lua_register( L, "RL_CreateLight", llightsCreateLight );
|
||||
lua_register( L, "RL_UpdateLightValues", llightsUpdateLightValues );
|
||||
/* RLGL */
|
||||
/* General render state. */
|
||||
lua_register( L, "RL_rlSetLineWidth", lrlglSetLineWidth );
|
||||
lua_register( L, "RL_rlGetLineWidth", lrlglGetLineWidth );
|
||||
}
|
||||
|
||||
/* Lua util functions. */
|
||||
|
||||
@@ -1284,11 +1284,12 @@ int lmodelsDrawMesh( lua_State *L ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* TODO Not testet. */
|
||||
/* TODO Untested. */
|
||||
/*
|
||||
> success = RL_DrawMeshInstanced( Mesh mesh, Material material, Matrix{} transforms, int instances )
|
||||
|
||||
Draw multiple mesh instances with material and different transforms
|
||||
Note! Untested.
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
41
src/rlgl.c
Normal file
41
src/rlgl.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "main.h"
|
||||
#include "state.h"
|
||||
#include "lua_core.h"
|
||||
#include "lrlgl.h"
|
||||
|
||||
/*
|
||||
## RLGL - General render state
|
||||
*/
|
||||
|
||||
/*
|
||||
> success = RL_rlSetLineWidth( float width )
|
||||
|
||||
Set the line drawing width
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
*/
|
||||
int lrlglSetLineWidth( lua_State *L ) {
|
||||
if ( !lua_isnumber( L, -1 ) ) {
|
||||
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_rlSetLineWidth( float width )" );
|
||||
lua_pushboolean( L, false );
|
||||
return 1;
|
||||
}
|
||||
rlSetLineWidth( lua_tonumber( L, -1 ) );
|
||||
lua_pushboolean( L, true );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
> width = RL_rlGetLineWidth()
|
||||
|
||||
Get the line drawing width
|
||||
|
||||
- Success return float
|
||||
*/
|
||||
int lrlglGetLineWidth( lua_State *L ) {
|
||||
lua_pushnumber( L, rlGetLineWidth() );
|
||||
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user