EnableEventWaiting and DisableEventWaiting.

This commit is contained in:
jussi
2024-02-25 21:02:11 +02:00
parent 47ed28b006
commit 625e4e0e4d
10 changed files with 148 additions and 37 deletions

82
API.md
View File

@@ -3824,6 +3824,18 @@ Get clipboard text content
---
> RL.EnableEventWaiting()
Enable waiting for events on EndDrawing(), no automatic event polling
---
> RL.DisableEventWaiting()
Disable waiting for events on EndDrawing(), automatic events polling
---
## Core - Cursor-related functions
---
@@ -4134,14 +4146,6 @@ Set target FPS (maximum)
---
> FPS = RL.GetFPS()
Get current FPS
- Success return int
---
> delta = RL.GetFrameTime()
Get time in seconds for last frame drawn (Delta time)
@@ -4158,6 +4162,36 @@ Get elapsed time in seconds since InitWindow()
---
> FPS = RL.GetFPS()
Get current FPS
- Success return int
---
## Core - Custom frame control functions
---
> RL.SwapScreenBuffer()
Swap back buffer with front buffer (screen drawing)
---
> RL.PollInputEvents()
Register all input events
---
> RL.WaitTime( number seconds )
Wait for some time (halt program execution)
---
## Core - Random values generation functions
---
@@ -6354,14 +6388,6 @@ Get Color structure from hexadecimal value
---
> color = RL.GetPixelColor( Texture texture, Vector2 position )
Get pixel color from source texture
- Success return Color
---
> size = RL.GetPixelDataSize( int width, int height, int format )
Get pixel data size in bytes for certain format
@@ -6756,6 +6782,22 @@ Encode one codepoint into UTF-8 byte array
---
> text = RL.TextSubtext( string text, int position, int length )
Get a piece of a text string
- Success return string
---
> text = RL.TextReplace( string text, string replace, string by )
Replace text string
- Success return string
---
> text = RL.TextInsert( string text, string insert, int position )
Insert text in a specific position, moves all text forward
@@ -6780,6 +6822,14 @@ Find first text occurrence within a string
---
> text = RL.TextToPascal( string text )
Get Pascal case notation version of provided string
- Success return string
---
## Models - Basic geometric 3D shapes drawing functions
---

View File

@@ -68,7 +68,6 @@ function RL.draw()
RL.ClearBackground( RL.RAYWHITE )
RL.DrawText( text, textPos, textSize, textColor )
end
```
Application folder structure should be...

View File

@@ -1441,6 +1441,14 @@ function RL.SetClipboardText( text ) end
---@return any text
function RL.GetClipboardText() end
---Enable waiting for events on EndDrawing(), no automatic event polling
---@return any RL.EnableEventWaiting
function RL.EnableEventWaiting() end
---Disable waiting for events on EndDrawing(), automatic events polling
---@return any RL.DisableEventWaiting
function RL.DisableEventWaiting() end
-- Core - Cursor-related functions
---Shows cursor
@@ -1693,11 +1701,6 @@ function RL.GetScreenToWorld2D( position, camera ) end
---@return any RL.SetTargetFPS
function RL.SetTargetFPS( fps ) end
---Get current FPS
---- Success return int
---@return any FPS
function RL.GetFPS() end
---Get time in seconds for last frame drawn (Delta time)
---- Success return float
---@return any delta
@@ -1708,6 +1711,26 @@ function RL.GetFrameTime() end
---@return any time
function RL.GetTime() end
---Get current FPS
---- Success return int
---@return any FPS
function RL.GetFPS() end
-- Core - Custom frame control functions
---Swap back buffer with front buffer (screen drawing)
---@return any RL.SwapScreenBuffer
function RL.SwapScreenBuffer() end
---Register all input events
---@return any RL.PollInputEvents
function RL.PollInputEvents() end
---Wait for some time (halt program execution)
---@param seconds any
---@return any RL.WaitTime
function RL.WaitTime( seconds ) end
-- Core - Random values generation functions
---Set the seed for the random number generator
@@ -3707,13 +3730,6 @@ function RL.ColorAlphaBlend( dst, src, tint ) end
---@return any color
function RL.GetColor( hexValue ) end
---Get pixel color from source texture
---- Success return Color
---@param texture any
---@param position table
---@return any color
function RL.GetPixelColor( texture, position ) end
---Get pixel data size in bytes for certain format
---- Success return int
---@param width integer
@@ -4080,6 +4096,22 @@ function RL.CodepointToUTF8( codepoint ) end
-- Text - Text strings management functions (no UTF-8 strings, only byte chars)
---Get a piece of a text string
---- Success return string
---@param text string
---@param position integer
---@param length integer
---@return any text
function RL.TextSubtext( text, position, length ) end
---Replace text string
---- Success return string
---@param text string
---@param replace string
---@param by string
---@return any text
function RL.TextReplace( text, replace, by ) end
---Insert text in a specific position, moves all text forward
---- Success return string
---@param text string
@@ -4102,6 +4134,12 @@ function RL.TextSplit( text, delimiter ) end
---@return any index
function RL.TextFindIndex( text, find ) end
---Get Pascal case notation version of provided string
---- Success return string
---@param text string
---@return any text
function RL.TextToPascal( text ) end
-- Models - Basic geometric 3D shapes drawing functions
---Draw a line in 3D world space

View File

@@ -53,6 +53,7 @@ local raylib = {
TextCopy = "Can be replaced by Lua equivalent",
TextIsEqual = "Can be replaced by Lua equivalent",
TextLength = "Can be replaced by Lua equivalent",
TextFormat = "Can be replaced by Lua equivalent",
TextJoin = "Can be replaced by Lua equivalent",
TextAppend = "Can be replaced by Lua equivalent",
TextToUpper = "Can be replaced by Lua equivalent",
@@ -63,6 +64,8 @@ local raylib = {
UploadMesh = "Handled internally",
UpdateMeshBuffer = "Handled internally",
UnloadWaveSamples = "Handled internally",
GetPixelColor = "Not seen necessary",
SetPixelColor = "Not seen necessary",
},
info = {
GenMeshHemiSphere = "Will be added",

View File

@@ -30,6 +30,7 @@ DETAILED CHANGES:
- ADDED: TextSubtext, TextReplace and TextToPascal.
- ADDED: Custom frame control functions.
- REMOVED: GetPixelColor. Deviates too much from raylib function.
- ADDED: EnableEventWaiting and DisableEventWaiting.
------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0

View File

@@ -20,7 +20,6 @@ Backlog {
* Platformer example physics update for true framerate independence.
* Android support
* Godot scene importer lib.
* Git submodules for raylib and lua. Should maybe find windows compatible lua repo for this.
}
Bugs {

View File

@@ -6,7 +6,7 @@ local textureSize = { 256, 96 }
local res = { 384, 216 }
local winSize = RL.GetScreenSize()
local winScale = 4
local framebuffer = -1
local framebuffer = nil
local TILE_SIZE = 32
local TILE_VERTEX_COLORS = { RL.WHITE, RL.WHITE, RL.WHITE, RL.WHITE }
@@ -91,11 +91,9 @@ function RL.draw()
RL.UpdateCamera3D( camera, RL.CAMERA_FIRST_PERSON )
pos = RL.GetCamera3DPosition( camera )
-- RL.BeginTextureMode( framebuffer )
RL.ClearBackground( { 100, 150, 150 } )
RL.BeginMode3D( camera )
-- Floor and ceiling.
for x = 0, 3 do
for y = 0, 10 do
@@ -119,7 +117,4 @@ function RL.draw()
drawSprites()
RL.EndMode3D()
-- RL.EndTextureMode()
-- RL.DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, WHITE )
end

View File

@@ -44,6 +44,8 @@ int lcoreGetWindowScaleDPI( lua_State* L );
int lcoreGetMonitorName( lua_State* L );
int lcoreSetClipboardText( lua_State* L );
int lcoreGetClipboardText( lua_State* L );
int lcoreEnableEventWaiting( lua_State* L );
int lcoreDisableEventWaiting( lua_State* L );
/* Cursor-related functions. */
int lcoreShowCursor( lua_State* L );
int lcoreHideCursor( lua_State* L );

View File

@@ -559,6 +559,28 @@ int lcoreGetClipboardText( lua_State* L ) {
return 1;
}
/*
> RL.EnableEventWaiting()
Enable waiting for events on EndDrawing(), no automatic event polling
*/
int lcoreEnableEventWaiting( lua_State* L ) {
EnableEventWaiting();
return 0;
}
/*
> RL.DisableEventWaiting()
Disable waiting for events on EndDrawing(), automatic events polling
*/
int lcoreDisableEventWaiting( lua_State* L ) {
DisableEventWaiting();
return 0;
}
/*
## Core - Cursor-related functions
*/

View File

@@ -1238,6 +1238,8 @@ void luaRegister() {
assingGlobalFunction( "GetMonitorName", lcoreGetMonitorName );
assingGlobalFunction( "SetClipboardText", lcoreSetClipboardText );
assingGlobalFunction( "GetClipboardText", lcoreGetClipboardText );
assingGlobalFunction( "EnableEventWaiting", lcoreEnableEventWaiting );
assingGlobalFunction( "DisableEventWaiting", lcoreDisableEventWaiting );
/* Cursor-related functions. */
assingGlobalFunction( "ShowCursor", lcoreShowCursor );
assingGlobalFunction( "HideCursor", lcoreHideCursor );