Added Wren scripting with module system 📚

Added Input pressed, released system
Added interface button support with wren onclick callback
This commit is contained in:
Antoine Pilote
2021-06-09 22:15:53 -04:00
parent aa2ebd04c8
commit 19db72aa22
1185 changed files with 320199 additions and 486 deletions

View File

@@ -86,15 +86,15 @@ public:
void OnUpdate(Timestep ts)
{
if (Input::IsKeyPress(GLFW_KEY_W))
if (Input::IsKeyDown(GLFW_KEY_W))
velocity.z = 5.0f;
else if (Input::IsKeyPress(GLFW_KEY_S))
else if (Input::IsKeyDown(GLFW_KEY_S))
velocity.z = -5.0f;
else
velocity.z = 0.0f;
if (Input::IsKeyPress(GLFW_KEY_A))
if (Input::IsKeyDown(GLFW_KEY_A))
velocity.x = 5.0f;
else if (Input::IsKeyPress(GLFW_KEY_D))
else if (Input::IsKeyDown(GLFW_KEY_D))
velocity.x = -5.0f;
else
velocity.x = 0.0f;
@@ -159,16 +159,18 @@ int main()
while (!Engine::GetCurrentWindow()->ShouldClose())
{
Engine::Tick();
Engine::Draw();
if (Input::IsKeyPress(GLFW_KEY_F8))
if (Input::IsKeyPressed(GLFW_KEY_F8))
Engine::ExitPlayMode();
editor.Draw();
Engine::EndDraw();
Engine::Tick();
}
Engine::Close();

View File

@@ -1,6 +1,8 @@
.button {
width: 100%;
height: 100%;
.hello{
width: 400px;
height: 200px;
}
.screen{
@@ -8,20 +10,11 @@
width: 100%;
justify-content: center;
flex-direction: row;
align-content:flex-end;
align-content:flex-start;
}
.container {
height: 50px;
width: 50%;
flex-direction: row;
justify-content: space-between;
align-content: center;
align-self:center;
padding: 8px;
}
.rect{
height: 200px;
width: 200px;
.items{
height: 30px;
width: 30px;
}

View File

@@ -1,23 +1,12 @@
<Canvas
script="Interface/Testing.lua"
script="Scripts/test Test"
groups="screen"
color="25 25 25 255"
color="25 25 25 9"
>
<Rect
color="50 50 50 255"
groups="container"
padding="8px 8px 8px 8px"
>
<p>Hello world!</p>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<Rect groups="items" color="200 0 200 255"></Rect>
<p groups="hello">Hello, world</p>
<Rect onclick="hello()"
groups="rect"
color="128 128 255 255">
</Rect>
<Slider value="sliderValue"/>
</Canvas>

View File

@@ -0,0 +1,62 @@
{
"Entities": [
{
"GetComponent<NameComponent>()": {
"Name": "Camera"
},
"GetComponent<ParentComponent>()": {
"HasParent": false,
"Type": "ParentComponent"
},
"GetComponent<TransformComponent>()": {
"Rotation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"Scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
},
"Translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"Type": "TransformComponent"
}
}
],
"Name": "",
"m_Environement": {
"AmbientColor": {
"w": 1.0141871010880041e-38,
"x": 4.489836626909252e+21,
"y": 7.618957098799247e+31,
"z": 1.0141871010880041e-38
},
"ProceduralSkybox": {
"AtmosphereRadius": 6380000.0,
"MieScattering": {
"x": 1.9999999494757503e-05,
"y": 1.9999999494757503e-05,
"z": 1.9999999494757503e-05
},
"RayleighScattering": {
"x": 5.80000005356851e-06,
"y": 1.3500000022759195e-05,
"z": 3.310000101919286e-05
},
"SunDirection": {
"x": 0.20000000298023224,
"y": 0.9591699838638306,
"z": 0.20000000298023224
},
"SunIntensity": 100.0,
"SurfaceRadius": 6360000.0
},
"VolumetricFog": 0.949999988079071,
"VolumetricStepCount": 100.0
}
}

View File

@@ -0,0 +1,108 @@
{
"Entities": [
{
"NameComponent": {
"Name": "Trenchbroom map"
},
"ParentComponent": {
"HasParent": false
},
"QuakeMapComponent": {
"HasCollisions": false,
"Path": "C:\\Dev\\Nuake\\Editor\\resources\\Maps\\texture_test.map"
},
"TransformComponent": {
"Rotation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"Scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
},
"Translation": {
"x": 9.199999809265137,
"y": 5.599999904632568,
"z": 0.0
},
"Type": "TransformComponent"
}
},
{
"LightComponent": {
"CastShadows": true,
"Color": {
"x": 1.0,
"y": 1.0,
"z": 1.0
},
"Direction": {
"x": 0.20000000298023224,
"y": 0.9591699838638306,
"z": 0.20000000298023224
},
"IsVolumetric": false,
"Strength": 10.0,
"SyncDirectionWithSky": true,
"Type": 0
},
"NameComponent": {
"Name": "Light"
},
"ParentComponent": {
"HasParent": false
},
"TransformComponent": {
"Rotation": {
"x": 0.0,
"y": -0.0,
"z": 0.0
},
"Scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
},
"Translation": {
"x": 7.035792350769043,
"y": 5.795107364654541,
"z": -0.9431453943252563
},
"Type": "TransformComponent"
}
}
],
"Name": "",
"m_Environement": {
"AmbientColor": {
"w": 0.0,
"x": null,
"y": 0.0,
"z": 0.0
},
"ProceduralSkybox": {
"AtmosphereRadius": 6380000.0,
"MieScattering": {
"x": 1.9999999494757503e-05,
"y": 1.9999999494757503e-05,
"z": 1.9999999494757503e-05
},
"RayleighScattering": {
"x": 5.80000005356851e-06,
"y": 1.3500000022759195e-05,
"z": 3.310000101919286e-05
},
"SunDirection": {
"x": 0.20000000298023224,
"y": 0.9591699838638306,
"z": 0.20000000298023224
},
"SunIntensity": 100.0,
"SurfaceRadius": 6360000.0
},
"VolumetricFog": 0.949999988079071,
"VolumetricStepCount": 100.0
}
}

View File

@@ -0,0 +1,70 @@
{
"Entities": [
{
"CameraComponent": {
"CameraInstance": {
"AspectRatio": 1.7777777910232544,
"Exposure": 1.0,
"Fov": 88.0,
"Speed": 1.0,
"m_Type": 1
}
},
"NameComponent": {
"Name": "Camera"
},
"ParentComponent": {
"HasParent": false
},
"TransformComponent": {
"Rotation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"Scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
},
"Translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"Type": "TransformComponent"
}
}
],
"Name": "",
"m_Environement": {
"AmbientColor": {
"w": 9.275544859982045e-39,
"x": 1.0193902624158886e-38,
"y": 8.449025394560124e-39,
"z": 9.275544859982045e-39
},
"ProceduralSkybox": {
"AtmosphereRadius": 6380000.0,
"MieScattering": {
"x": 1.9999999494757503e-05,
"y": 1.9999999494757503e-05,
"z": 1.9999999494757503e-05
},
"RayleighScattering": {
"x": 5.80000005356851e-06,
"y": 1.3500000022759195e-05,
"z": 3.310000101919286e-05
},
"SunDirection": {
"x": 0.20000000298023224,
"y": 0.9591699838638306,
"z": 0.20000000298023224
},
"SunIntensity": 100.0,
"SurfaceRadius": 6360000.0
},
"VolumetricFog": 0.949999988079071,
"VolumetricStepCount": 100.0
}
}

View File

@@ -0,0 +1,15 @@
class Engine {
foreign static Log(msg)
}
class Vector3 {
construct new(x, y, z) {
_x = x
_y = y
_z = z
}
}
class Entity {
foreign GetComponent(type)
}

View File

@@ -0,0 +1,18 @@
import "Scripts/Engine" for Engine
class Test {
init() {
System.print("hello init")
}
update(t) {
System.print("hello update %(t)")
}
exit() {
System.print("hello exit ")
}
static hello() {
Engine.Log("Hello from foreign")
}
}

View File

@@ -675,10 +675,10 @@ void EditorInterface::DrawDirectoryExplorer()
}
}
ImGui::EndTable();
}
ImGui::EndTable();
}
ImGui::End();
}