mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-27 16:17:12 +03:00
Maths functions scripting api
This commit is contained in:
21
Nuake/src/Resource/MaterialCollection.h
Normal file
21
Nuake/src/Resource/MaterialCollection.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "src/Core/Core.h"
|
||||
#include "src/Rendering/Materials/Material.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Nuake {
|
||||
class MaterialCollection
|
||||
{
|
||||
|
||||
private:
|
||||
std::vector<Ref<Material>> m_Materials;
|
||||
public:
|
||||
|
||||
std::string Path;
|
||||
MaterialCollection(const std::string path)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -26,6 +26,8 @@ namespace Nuake {
|
||||
RegisterMethod("Radians(_)", (void*)Radians);
|
||||
RegisterMethod("Degrees(_)", (void*)Degrees);
|
||||
RegisterMethod("Cross_(_,_,_,_,_,_)", (void*)Cross);
|
||||
RegisterMethod("Dot_(_,_,_,_,_,_)", (void*)Dot);
|
||||
RegisterMethod("Length_(_,_,_)", (void*)Length);
|
||||
}
|
||||
|
||||
static void Sqrt(WrenVM* vm)
|
||||
@@ -85,6 +87,28 @@ namespace Nuake {
|
||||
wrenInsertInList(vm, 0, -1, 2);
|
||||
wrenInsertInList(vm, 0, -1, 3);
|
||||
}
|
||||
|
||||
static void Dot(WrenVM* vm)
|
||||
{
|
||||
Vector3 v1 = Vector3(wrenGetSlotDouble(vm, 1),
|
||||
wrenGetSlotDouble(vm, 2),
|
||||
wrenGetSlotDouble(vm, 3));
|
||||
Vector3 v2 = Vector3(wrenGetSlotDouble(vm, 4),
|
||||
wrenGetSlotDouble(vm, 5),
|
||||
wrenGetSlotDouble(vm, 6));
|
||||
float dot = glm::dot(v1, v2);
|
||||
|
||||
wrenSetSlotDouble(vm, 0, dot);
|
||||
}
|
||||
|
||||
static void Length(WrenVM* vm)
|
||||
{
|
||||
Vector3 v1 = Vector3(wrenGetSlotDouble(vm, 1),
|
||||
wrenGetSlotDouble(vm, 2),
|
||||
wrenGetSlotDouble(vm, 3));
|
||||
|
||||
wrenSetSlotDouble(vm, 0, v1.length());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
31
Nuake/src/UI/Nodes/TextInput.h
Normal file
31
Nuake/src/UI/Nodes/TextInput.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <string>
|
||||
#include "Node.h"
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
namespace UI
|
||||
{
|
||||
class TextInput : public Node
|
||||
{
|
||||
private:
|
||||
std::string content = "";
|
||||
bool IsFocus = false;
|
||||
|
||||
Ref<Node> Background;
|
||||
public:
|
||||
TextInput()
|
||||
{
|
||||
Background = CreateRef<Node>();
|
||||
Background->NormalStyle.MinWidth = {200, Layout::Unit::PIXEL };
|
||||
Background->NormalStyle.MinHeight = { 30, Layout::Unit::PIXEL };
|
||||
|
||||
Childrens.push_back(Background);
|
||||
}
|
||||
|
||||
void Draw()
|
||||
{
|
||||
Renderer2D::DrawRect()
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user