mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 16:09:06 +07:00
core lua api is almost complete
This commit is contained in:
8
samples/bin/library/scripts/emmy/core/dbgui.lua
Normal file
8
samples/bin/library/scripts/emmy/core/dbgui.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
---@class dbgui
|
||||
local dbgui = {
|
||||
---@type boolean
|
||||
visible = false
|
||||
}
|
||||
|
||||
---@type dbgui
|
||||
_G.the_dbgui = _G.the_dbgui or dbgui
|
||||
17
samples/bin/library/scripts/emmy/core/debug.lua
Normal file
17
samples/bin/library/scripts/emmy/core/debug.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
---@class debug
|
||||
local debug = {
|
||||
---@type fun(self: debug, message: string)
|
||||
trace = function(self, message) end,
|
||||
|
||||
---@type fun(self: debug, message: string)
|
||||
warning = function(self, message) end,
|
||||
|
||||
---@type fun(self: debug, message: string)
|
||||
error = function(self, message) end,
|
||||
|
||||
---@type fun(self: debug, message: string)
|
||||
fatal = function(self, message) end
|
||||
}
|
||||
|
||||
---@type debug
|
||||
_G.the_debug = _G.the_debug or debug
|
||||
20
samples/bin/library/scripts/emmy/core/engine.lua
Normal file
20
samples/bin/library/scripts/emmy/core/engine.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
---@class engine
|
||||
local engine = {
|
||||
---@type number
|
||||
time = 0,
|
||||
|
||||
---@type number
|
||||
delta_time = 0,
|
||||
|
||||
---@type number
|
||||
frame_rate = 0,
|
||||
|
||||
---@type number
|
||||
frame_count = 0,
|
||||
|
||||
---@type number
|
||||
realtime_time = 0
|
||||
}
|
||||
|
||||
---@type engine
|
||||
_G.the_engine = _G.the_engine or engine
|
||||
11
samples/bin/library/scripts/emmy/core/input.lua
Normal file
11
samples/bin/library/scripts/emmy/core/input.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
---@class input
|
||||
local input = {
|
||||
---@type mouse
|
||||
mouse = {},
|
||||
|
||||
---@type keyboard
|
||||
keyboard = {}
|
||||
}
|
||||
|
||||
---@type input
|
||||
_G.the_input = _G.the_input or input
|
||||
35
samples/bin/library/scripts/emmy/core/keyboard.lua
Normal file
35
samples/bin/library/scripts/emmy/core/keyboard.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
---@class keyboard
|
||||
local keyboard = {
|
||||
---@type fun(self: keyboard, key : string): boolean
|
||||
is_key_pressed = function(self, key) return false end,
|
||||
|
||||
---@type fun(self: keyboard, key : string): boolean
|
||||
is_key_just_pressed = function(self, key) return false end,
|
||||
|
||||
---@type fun(self: keyboard, key : string): boolean
|
||||
is_key_just_released = function(self, key) return false end,
|
||||
|
||||
---@type string
|
||||
input_text = "",
|
||||
|
||||
---@type boolean
|
||||
is_any_key_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_key_just_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_key_just_released = false,
|
||||
|
||||
---@type string[]
|
||||
pressed_keys = {},
|
||||
|
||||
---@type string[]
|
||||
just_pressed_keys = {},
|
||||
|
||||
---@type string[]
|
||||
just_released_keys = {}
|
||||
}
|
||||
|
||||
---@type keyboard
|
||||
_G.the_keyboard = _G.the_keyboard or keyboard
|
||||
38
samples/bin/library/scripts/emmy/core/mouse.lua
Normal file
38
samples/bin/library/scripts/emmy/core/mouse.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
---@class mouse
|
||||
local mouse = {
|
||||
---@type fun(self: mouse, button : string): boolean
|
||||
is_button_pressed = function(self, button) return false end,
|
||||
|
||||
---@type fun(self: mouse, button : string): boolean
|
||||
is_button_just_pressed = function(self, button) return false end,
|
||||
|
||||
---@type fun(self: mouse, button : string): boolean
|
||||
is_button_just_released = function(self, button) return false end,
|
||||
|
||||
---@type v2f
|
||||
cursor_pos = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
scroll_delta = v2f.zero(),
|
||||
|
||||
---@type boolean
|
||||
is_any_button_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_button_just_pressed = false,
|
||||
|
||||
---@type boolean
|
||||
is_any_button_just_released = false,
|
||||
|
||||
---@type string[]
|
||||
pressed_buttons = {},
|
||||
|
||||
---@type string[]
|
||||
just_pressed_buttons = {},
|
||||
|
||||
---@type string[]
|
||||
just_released_buttons = {}
|
||||
}
|
||||
|
||||
---@type mouse
|
||||
_G.the_mouse = _G.the_mouse or mouse
|
||||
50
samples/bin/library/scripts/emmy/core/window.lua
Normal file
50
samples/bin/library/scripts/emmy/core/window.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
---@class window
|
||||
local window = {
|
||||
---@type fun(self: window)
|
||||
hide = function(self) end,
|
||||
|
||||
---@type fun(self: window)
|
||||
show = function(self) end,
|
||||
|
||||
---@type fun(self: window)
|
||||
restore = function(self) end,
|
||||
|
||||
---@type fun(self: window)
|
||||
minimize = function(self) end,
|
||||
|
||||
---@type boolean
|
||||
enable = true,
|
||||
|
||||
---@type boolean
|
||||
visible = true,
|
||||
|
||||
---@type boolean
|
||||
focused = true,
|
||||
|
||||
---@type boolean
|
||||
minimized = true,
|
||||
|
||||
---@type boolean
|
||||
fullscreen = false,
|
||||
|
||||
---@type boolean
|
||||
cursor_hidden = false,
|
||||
|
||||
---@type v2f
|
||||
real_size = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
virtual_size = v2f.zero(),
|
||||
|
||||
---@type v2f
|
||||
framebuffer_size = v2f.zero(),
|
||||
|
||||
---@type string
|
||||
title = "",
|
||||
|
||||
---@type boolean
|
||||
should_close = false
|
||||
}
|
||||
|
||||
---@type window
|
||||
_G.the_window = _G.the_window or window
|
||||
Reference in New Issue
Block a user