Some more fixes
This commit is contained in:
parent
bd3cdbb23d
commit
192df6edc4
@ -262,58 +262,65 @@ namespace ui_scripting
|
|||||||
{
|
{
|
||||||
check_resize();
|
check_resize();
|
||||||
|
|
||||||
const auto background_material = game::Material_RegisterHandle(this->material.data());
|
if (this->background_color[3] > 0)
|
||||||
draw_image(
|
{
|
||||||
relative(this->x) + relative(this->border_width[3]),
|
const auto background_material = game::Material_RegisterHandle(this->material.data());
|
||||||
relative(this->y) + relative(this->border_width[0]),
|
|
||||||
relative(this->w),
|
|
||||||
relative(this->h),
|
|
||||||
(float*)this->slice,
|
|
||||||
(float*)this->background_color,
|
|
||||||
background_material
|
|
||||||
);
|
|
||||||
|
|
||||||
const auto _border_material = game::Material_RegisterHandle(this->border_material.data());
|
draw_image(
|
||||||
|
relative(this->x) + relative(this->border_width[3]),
|
||||||
|
relative(this->y) + relative(this->border_width[0]),
|
||||||
|
relative(this->w),
|
||||||
|
relative(this->h),
|
||||||
|
(float*)this->slice,
|
||||||
|
(float*)this->background_color,
|
||||||
|
background_material
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
draw_image(
|
if (this->border_color[3] > 0)
|
||||||
relative(this->x),
|
{
|
||||||
relative(this->y),
|
const auto _border_material = game::Material_RegisterHandle(this->border_material.data());
|
||||||
relative(this->w) + relative(this->border_width[1]) + relative(this->border_width[3]),
|
|
||||||
relative(this->border_width[0]),
|
|
||||||
(float*)this->slice,
|
|
||||||
(float*)this->border_color,
|
|
||||||
_border_material
|
|
||||||
);
|
|
||||||
|
|
||||||
draw_image(
|
draw_image(
|
||||||
relative(this->x) + relative(this->border_width[3]) + relative(this->w),
|
relative(this->x),
|
||||||
relative(this->y) + relative(this->border_width[0]),
|
relative(this->y),
|
||||||
relative(this->border_width[1]),
|
relative(this->w) + relative(this->border_width[1]) + relative(this->border_width[3]),
|
||||||
relative(this->h),
|
relative(this->border_width[0]),
|
||||||
(float*)this->slice,
|
(float*)this->slice,
|
||||||
(float*)this->border_color,
|
(float*)this->border_color,
|
||||||
_border_material
|
_border_material
|
||||||
);
|
);
|
||||||
|
|
||||||
draw_image(
|
draw_image(
|
||||||
relative(this->x),
|
relative(this->x) + relative(this->border_width[3]) + relative(this->w),
|
||||||
relative(this->y) + relative(this->h) + relative(this->border_width[0]),
|
relative(this->y) + relative(this->border_width[0]),
|
||||||
relative(this->w) + relative(this->border_width[1]) + relative(this->border_width[3]),
|
relative(this->border_width[1]),
|
||||||
relative(this->border_width[2]),
|
relative(this->h),
|
||||||
(float*)this->slice,
|
(float*)this->slice,
|
||||||
(float*)this->border_color,
|
(float*)this->border_color,
|
||||||
_border_material
|
_border_material
|
||||||
);
|
);
|
||||||
|
|
||||||
draw_image(
|
draw_image(
|
||||||
relative(this->x),
|
relative(this->x),
|
||||||
relative(this->y) + relative(this->border_width[0]),
|
relative(this->y) + relative(this->h) + relative(this->border_width[0]),
|
||||||
relative(this->border_width[3]),
|
relative(this->w) + relative(this->border_width[1]) + relative(this->border_width[3]),
|
||||||
relative(this->h),
|
relative(this->border_width[2]),
|
||||||
(float*)this->slice,
|
(float*)this->slice,
|
||||||
(float*)this->border_color,
|
(float*)this->border_color,
|
||||||
_border_material
|
_border_material
|
||||||
);
|
);
|
||||||
|
|
||||||
|
draw_image(
|
||||||
|
relative(this->x),
|
||||||
|
relative(this->y) + relative(this->border_width[0]),
|
||||||
|
relative(this->border_width[3]),
|
||||||
|
relative(this->h),
|
||||||
|
(float*)this->slice,
|
||||||
|
(float*)this->border_color,
|
||||||
|
_border_material
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!this->text.empty())
|
if (!this->text.empty())
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "engine.hpp"
|
#include "engine.hpp"
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
|
|
||||||
|
#include "../../../component/scheduler.hpp"
|
||||||
|
|
||||||
#include <utils/io.hpp>
|
#include <utils/io.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
|
|
||||||
@ -216,6 +218,11 @@ namespace ui_scripting::lua::engine
|
|||||||
std::vector<element*> previous_elements;
|
std::vector<element*> previous_elements;
|
||||||
void handle_mousemove_event(const int x, const int y)
|
void handle_mousemove_event(const int x, const int y)
|
||||||
{
|
{
|
||||||
|
if (mouse[0] == x && mouse[1] == y)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mouse[0] = x;
|
mouse[0] = x;
|
||||||
mouse[1] = y;
|
mouse[1] = y;
|
||||||
|
|
||||||
@ -371,20 +378,23 @@ namespace ui_scripting::lua::engine
|
|||||||
|
|
||||||
void ui_event(const std::string& type, const std::vector<int>& arguments)
|
void ui_event(const std::string& type, const std::vector<int>& arguments)
|
||||||
{
|
{
|
||||||
if (type == "key")
|
::scheduler::once([type, arguments]()
|
||||||
{
|
{
|
||||||
handle_key_event(arguments[0], arguments[1]);
|
if (type == "key")
|
||||||
}
|
{
|
||||||
|
handle_key_event(arguments[0], arguments[1]);
|
||||||
|
}
|
||||||
|
|
||||||
if (type == "char")
|
if (type == "char")
|
||||||
{
|
{
|
||||||
handle_char_event(arguments[0]);
|
handle_char_event(arguments[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == "mousemove")
|
if (type == "mousemove")
|
||||||
{
|
{
|
||||||
handle_mousemove_event(relative_mouse(arguments[0]), relative_mouse(arguments[1]));
|
handle_mousemove_event(relative_mouse(arguments[0]), relative_mouse(arguments[1]));
|
||||||
}
|
}
|
||||||
|
}, ::scheduler::pipeline::renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify(const event& e)
|
void notify(const event& e)
|
||||||
|
Loading…
Reference in New Issue
Block a user