Updated Intelisence Code in the Engine and keycode bindings
This commit is contained in:
parent
91133a0396
commit
fa4252b593
@ -1,5 +1,5 @@
|
||||
local Engine = require("./assets/scripts/engine")
|
||||
local KeyCode = require("./assets/scripts/keycode")
|
||||
local Engine = require("engine")
|
||||
local KeyCode = require("keycode")
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ local transform = nil
|
||||
|
||||
local currentRotation = 0 -- Current Y-axis rotation in degrees
|
||||
|
||||
local rotationSpeed = 120 -- Degrees per second
|
||||
local rotationSpeed = 240 -- Degrees per second
|
||||
local moveSpeed = 600 -- Units per second
|
||||
|
||||
function OnInit()
|
||||
@ -28,9 +28,9 @@ function OnInit()
|
||||
currentRotation = rotation.y
|
||||
|
||||
Engine.Expose("Position X", rotation.x)
|
||||
Engine.Expose("Position Y", rotation.y)
|
||||
Engine.Expose("Position Z", rotation.z)
|
||||
Engine.Expose("Rotation Y", currentRotation)
|
||||
Engine.Log("Init Done")
|
||||
Engine.Log("Init Done", {0,1,0,1})
|
||||
end
|
||||
|
||||
function OnUpdate(deltaTime)
|
||||
@ -113,6 +113,6 @@ function OnUpdate(deltaTime)
|
||||
|
||||
-- Expose updated position and rotation
|
||||
Engine.Expose("Position X", position.x)
|
||||
Engine.Expose("Position Y", position.y)
|
||||
Engine.Expose("Position Z", rotation.z)
|
||||
Engine.Expose("Rotation Y", currentRotation)
|
||||
end
|
||||
|
@ -1,9 +1,76 @@
|
||||
local Engine = {
|
||||
Log = _T_Engine_Table.Log,
|
||||
Expose = _T_Engine_Table.Expose,
|
||||
KeyDown = _T_Engine_Table.KeyDown,
|
||||
ScriptName = _T_Engine_Table.ScriptName,
|
||||
GetGameObjectByTag = _T_Engine_Table.GetGameObjectByTag
|
||||
}
|
||||
--@module Engine
|
||||
|
||||
--[[
|
||||
Engine.lua serves as the Lua interface for your engine's functionalities.
|
||||
It maps C++ bound functions from `_T_Engine_Table` to a Lua `Engine` table,
|
||||
enriched with EmmyLua annotations for enhanced IntelliSense support.
|
||||
]]
|
||||
|
||||
---@class Color
|
||||
---@field r number Red component (0-1)
|
||||
---@field g number Green component (0-1)
|
||||
---@field b number Blue component (0-1)
|
||||
---@field a number Alpha component (0-1)
|
||||
|
||||
---@class Vector3
|
||||
---@field x number
|
||||
---@field y number
|
||||
---@field z number
|
||||
|
||||
---@class Transform
|
||||
---@field position Vector3 The position of the Transform.
|
||||
---@field rotation Vector3 The rotation of the Transform.
|
||||
---@field scale Vector3 The scale of the Transform.
|
||||
|
||||
---@class Camera
|
||||
---@field fieldOfView number The camera's field of view.
|
||||
---@field nearClipPlane number The near clipping plane distance.
|
||||
---@field farClipPlane number The far clipping plane distance.
|
||||
|
||||
---@class Mesh
|
||||
---@field vertices Vector3[] The vertices of the mesh.
|
||||
---@field indices number[] The indices defining the mesh's triangles.
|
||||
|
||||
---@class GameObject
|
||||
local GameObject = {}
|
||||
|
||||
---Retrieves a component attached to the GameObject.
|
||||
---@param componentName string The name of the component to retrieve ("Transform", "Camera", "Mesh")
|
||||
---@return Transform|Camera|Mesh|nil The requested component or `nil` if not found.
|
||||
function GameObject:GetComponent(componentName)
|
||||
-- The actual implementation is bound in C++.
|
||||
-- This is just for IntelliSense support.
|
||||
end
|
||||
|
||||
---@class Engine
|
||||
local Engine = {}
|
||||
|
||||
---Logs a message with an optional color and alpha.
|
||||
---@param message string The message to log.
|
||||
---@param color? Color Optional color and alpha for the log message.
|
||||
---@return void
|
||||
Engine.Log = _T_Engine_Table.Log
|
||||
|
||||
---Exposes a variable to the engine.
|
||||
---@param name string The identifier name of the variable.
|
||||
---@param label string A human-readable label for the variable.
|
||||
---@param value number|string|boolean|nil The value to expose (int, float, bool, string, nil).
|
||||
---@return void
|
||||
Engine.Expose = _T_Engine_Table.Expose
|
||||
|
||||
---Checks if a specific key is currently pressed.
|
||||
---@param keyCode KeyCode The key code to check.
|
||||
---@return boolean True if the key is pressed, false otherwise.
|
||||
Engine.KeyDown = _T_Engine_Table.KeyDown
|
||||
|
||||
---Retrieves the name of the current script.
|
||||
---@return string The name of the script.
|
||||
Engine.ScriptName = _T_Engine_Table.ScriptName
|
||||
|
||||
---Gets a GameObject by its tag.
|
||||
---@param tag string The tag associated with the GameObject.
|
||||
---@return GameObject|nil The GameObject with the specified tag, or `nil` if not found.
|
||||
Engine.GetGameObjectByTag = _T_Engine_Table.GetGameObjectByTag
|
||||
|
||||
|
||||
return Engine
|
||||
|
@ -1,5 +1,128 @@
|
||||
--@module KeyCodes
|
||||
|
||||
local _Engine_KeyCodes = _T_KeyCode_Table
|
||||
|
||||
---@class KeyCode
|
||||
---@field Space number
|
||||
---@field Apostrophe number
|
||||
---@field Comma number
|
||||
---@field Minus number
|
||||
---@field Period number
|
||||
---@field Slash number
|
||||
---@field D0 number
|
||||
---@field D1 number
|
||||
---@field D2 number
|
||||
---@field D3 number
|
||||
---@field D4 number
|
||||
---@field D5 number
|
||||
---@field D6 number
|
||||
---@field D7 number
|
||||
---@field D8 number
|
||||
---@field D9 number
|
||||
---@field Semicolon number
|
||||
---@field Equal number
|
||||
---@field A number
|
||||
---@field B number
|
||||
---@field C number
|
||||
---@field D number
|
||||
---@field E number
|
||||
---@field F number
|
||||
---@field G number
|
||||
---@field H number
|
||||
---@field I number
|
||||
---@field J number
|
||||
---@field K number
|
||||
---@field L number
|
||||
---@field M number
|
||||
---@field N number
|
||||
---@field O number
|
||||
---@field P number
|
||||
---@field Q number
|
||||
---@field R number
|
||||
---@field S number
|
||||
---@field T number
|
||||
---@field U number
|
||||
---@field V number
|
||||
---@field W number
|
||||
---@field X number
|
||||
---@field Y number
|
||||
---@field Z number
|
||||
---@field LeftBracket number
|
||||
---@field Backslash number
|
||||
---@field RightBracket number
|
||||
---@field GraveAccent number
|
||||
---@field World1 number
|
||||
---@field World2 number
|
||||
---@field Escape number
|
||||
---@field Enter number
|
||||
---@field Tab number
|
||||
---@field Backspace number
|
||||
---@field Insert number
|
||||
---@field Delete number
|
||||
---@field Right number
|
||||
---@field Left number
|
||||
---@field Down number
|
||||
---@field Up number
|
||||
---@field PageUp number
|
||||
---@field PageDown number
|
||||
---@field Home number
|
||||
---@field End number
|
||||
---@field CapsLock number
|
||||
---@field ScrollLock number
|
||||
---@field NumLock number
|
||||
---@field PrintScreen number
|
||||
---@field Pause number
|
||||
---@field F1 number
|
||||
---@field F2 number
|
||||
---@field F3 number
|
||||
---@field F4 number
|
||||
---@field F5 number
|
||||
---@field F6 number
|
||||
---@field F7 number
|
||||
---@field F8 number
|
||||
---@field F9 number
|
||||
---@field F10 number
|
||||
---@field F11 number
|
||||
---@field F12 number
|
||||
---@field F13 number
|
||||
---@field F14 number
|
||||
---@field F15 number
|
||||
---@field F16 number
|
||||
---@field F17 number
|
||||
---@field F18 number
|
||||
---@field F19 number
|
||||
---@field F20 number
|
||||
---@field F21 number
|
||||
---@field F22 number
|
||||
---@field F23 number
|
||||
---@field F24 number
|
||||
---@field F25 number
|
||||
---@field KP0 number
|
||||
---@field KP1 number
|
||||
---@field KP2 number
|
||||
---@field KP3 number
|
||||
---@field KP4 number
|
||||
---@field KP5 number
|
||||
---@field KP6 number
|
||||
---@field KP7 number
|
||||
---@field KP8 number
|
||||
---@field KP9 number
|
||||
---@field KPDecimal number
|
||||
---@field KPDivide number
|
||||
---@field KPMultiply number
|
||||
---@field KPSubtract number
|
||||
---@field KPAdd number
|
||||
---@field KPEnter number
|
||||
---@field KPEqual number
|
||||
---@field LeftShift number
|
||||
---@field LeftControl number
|
||||
---@field LeftAlt number
|
||||
---@field LeftSuper number
|
||||
---@field RightShift number
|
||||
---@field RightControl number
|
||||
---@field RightAlt number
|
||||
---@field RightSuper number
|
||||
---@field Menu number
|
||||
local KeyCodes = {
|
||||
Space = _Engine_KeyCodes.Space,
|
||||
Apostrophe = _Engine_KeyCodes.Apostrophe,
|
||||
|
34
imgui.ini
34
imgui.ini
@ -1,6 +1,6 @@
|
||||
[Window][DockSpace]
|
||||
Pos=0,0
|
||||
Size=1280,720
|
||||
Size=1920,1177
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
@ -80,8 +80,8 @@ Collapsed=0
|
||||
DockId=0x0000001F,0
|
||||
|
||||
[Window][Performance##performance]
|
||||
Pos=8,432
|
||||
Size=335,280
|
||||
Pos=8,702
|
||||
Size=335,467
|
||||
Collapsed=0
|
||||
DockId=0x0000001C,0
|
||||
|
||||
@ -105,7 +105,7 @@ DockId=0x0000000F,0
|
||||
|
||||
[Window][Scene Window##SceneWindow]
|
||||
Pos=8,28
|
||||
Size=335,402
|
||||
Size=335,672
|
||||
Collapsed=0
|
||||
DockId=0x0000001B,0
|
||||
|
||||
@ -134,26 +134,26 @@ Collapsed=0
|
||||
DockId=0x0000001E,0
|
||||
|
||||
[Window][ Logger##logger]
|
||||
Pos=345,389
|
||||
Size=549,323
|
||||
Pos=345,846
|
||||
Size=1170,323
|
||||
Collapsed=0
|
||||
DockId=0x00000025,0
|
||||
|
||||
[Window][ Editor##EditorWindow]
|
||||
Pos=345,28
|
||||
Size=549,359
|
||||
Size=1170,816
|
||||
Collapsed=0
|
||||
DockId=0x0000001F,0
|
||||
|
||||
[Window][ Inspector##InspectorWindow]
|
||||
Pos=896,28
|
||||
Size=376,684
|
||||
Pos=1517,28
|
||||
Size=395,1141
|
||||
Collapsed=0
|
||||
DockId=0x00000022,0
|
||||
|
||||
[Window][ Profiler]
|
||||
Pos=345,389
|
||||
Size=549,323
|
||||
Pos=345,846
|
||||
Size=1170,323
|
||||
Collapsed=0
|
||||
DockId=0x00000025,1
|
||||
|
||||
@ -170,12 +170,12 @@ Column 2 Weight=0.9665
|
||||
Column 3 Weight=0.6950
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=198,241 Size=1264,684 Split=X Selected=0xF7365A5A
|
||||
DockNode ID=0x00000020 Parent=0x14621557 SizeRef=886,684 Split=X
|
||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,51 Size=1904,1141 Split=X Selected=0xF7365A5A
|
||||
DockNode ID=0x00000020 Parent=0x14621557 SizeRef=884,684 Split=X
|
||||
DockNode ID=0x00000013 Parent=0x00000020 SizeRef=335,1142 Split=Y Selected=0x818D04BB
|
||||
DockNode ID=0x0000001B Parent=0x00000013 SizeRef=264,672 HiddenTabBar=1 Selected=0x1D5D92B6
|
||||
DockNode ID=0x0000001C Parent=0x00000013 SizeRef=264,467 HiddenTabBar=1 Selected=0x818D04BB
|
||||
DockNode ID=0x00000014 Parent=0x00000020 SizeRef=1567,1142 Split=X
|
||||
DockNode ID=0x00000014 Parent=0x00000020 SizeRef=547,1142 Split=X
|
||||
DockNode ID=0x00000015 Parent=0x00000014 SizeRef=1158,1142 Split=X
|
||||
DockNode ID=0x00000011 Parent=0x00000015 SizeRef=265,1142 Selected=0x1D5D92B6
|
||||
DockNode ID=0x00000012 Parent=0x00000015 SizeRef=1259,1142 Split=X
|
||||
@ -192,8 +192,8 @@ DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=198,241 Si
|
||||
DockNode ID=0x0000000D Parent=0x00000003 SizeRef=1202,571 Split=Y Selected=0xDFF75B3F
|
||||
DockNode ID=0x00000017 Parent=0x0000000D SizeRef=1202,776 Split=Y Selected=0xDFF75B3F
|
||||
DockNode ID=0x0000001D Parent=0x00000017 SizeRef=518,720 Split=Y Selected=0x9A7B23B9
|
||||
DockNode ID=0x0000001F Parent=0x0000001D SizeRef=549,359 CentralNode=1 Selected=0x9A7B23B9
|
||||
DockNode ID=0x00000025 Parent=0x0000001D SizeRef=549,323 Selected=0x1F29F1F5
|
||||
DockNode ID=0x0000001F Parent=0x0000001D SizeRef=549,359 CentralNode=1 HiddenTabBar=1 Selected=0x9A7B23B9
|
||||
DockNode ID=0x00000025 Parent=0x0000001D SizeRef=549,323 Selected=0x7A66B86B
|
||||
DockNode ID=0x0000001E Parent=0x00000017 SizeRef=518,417 Selected=0xC74E1AEE
|
||||
DockNode ID=0x00000018 Parent=0x0000000D SizeRef=1202,364 Split=X Selected=0x1C0788A1
|
||||
DockNode ID=0x00000019 Parent=0x00000018 SizeRef=601,364 Selected=0x1C0788A1
|
||||
@ -202,7 +202,7 @@ DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=198,241 Si
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=1202,291 Selected=0x9DD4E196
|
||||
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=334,1142 HiddenTabBar=1 Selected=0x36DC96AB
|
||||
DockNode ID=0x00000016 Parent=0x00000014 SizeRef=420,1142 Selected=0x8D0E8380
|
||||
DockNode ID=0x00000022 Parent=0x14621557 SizeRef=376,684 Selected=0xD1D25642
|
||||
DockNode ID=0x00000022 Parent=0x14621557 SizeRef=395,684 HiddenTabBar=1 Selected=0xD1D25642
|
||||
DockSpace ID=0xC6145A92 Pos=8,27 Size=1904,1142 Split=X
|
||||
DockNode ID=0x0000000F Parent=0xC6145A92 SizeRef=301,1142 Selected=0xA8433A03
|
||||
DockNode ID=0x00000010 Parent=0xC6145A92 SizeRef=1601,1142 CentralNode=1
|
||||
|
@ -2,10 +2,6 @@ Entities:
|
||||
- ID: 0
|
||||
Name: Bacround
|
||||
Components:
|
||||
Transform:
|
||||
Position: [0, 300, 0]
|
||||
Rotation: [0, 0, 0]
|
||||
Scale: [1, 1, 1]
|
||||
Mesh:
|
||||
MeshPath: assets/models/sponza.obj
|
||||
submeshes_len: 26
|
||||
@ -160,15 +156,13 @@ Entities:
|
||||
- id: 26
|
||||
type: texture_diffuse
|
||||
path: textures/vase_hanging.tga
|
||||
Transform:
|
||||
Position: [0, 300, 0]
|
||||
Rotation: [0, 0, 0]
|
||||
Scale: [1, 1, 1]
|
||||
- ID: 1
|
||||
Name: Camera
|
||||
Components:
|
||||
ScriptComponent:
|
||||
ScriptPath: assets/scripts/camera.lua
|
||||
Transform:
|
||||
Position: [206.62178, 200, 9.92187023]
|
||||
Rotation: [0, 356.40271, 0]
|
||||
Scale: [1, 1, 1]
|
||||
CameraComponent:
|
||||
IsPerspective: true
|
||||
DefaultRuntimeCamera: true
|
||||
@ -176,3 +170,9 @@ Entities:
|
||||
AspectRatio: 1.75
|
||||
NearPlane: 0.100000001
|
||||
FarPlane: 7000
|
||||
Transform:
|
||||
Position: [-850.547668, 200, -43.3881149]
|
||||
Rotation: [0, 177.660431, 0]
|
||||
Scale: [1, 1, 1]
|
||||
ScriptComponent:
|
||||
ScriptPath: assets/scripts/camera.lua
|
Loading…
Reference in New Issue
Block a user