Lots of stuff

This commit is contained in:
Vortrex
2020-12-11 01:51:55 -06:00
parent ecc495de5c
commit fbaafa6c0c
67 changed files with 5755 additions and 4208 deletions

View File

@@ -4,8 +4,8 @@ mexui.Component.Control = function(window, x, y, w, h, styles, callback)
mexui.Entity.StyleableEntity.call(this, this.linkComponentStyles('Control', styles));
this.window = window;
this.position = new Vec2(x, y);
this.size = new Vec2(w, h);
this.position = toVector2(x, y);
this.size = toVector2(w, h);
this.callback = callback;
this.boundTo = null;
@@ -87,7 +87,7 @@ mexui.Component.Control.prototype.getScreenPosition = function()
{
var pos = mexui.util.addVec2(this.window.position, this.position);
if(this.boundTo)
pos = mexui.util.addVec2(pos, new Vec2(-this.boundTo.axis.x.getScrolledOffsetFixedStart(), -this.boundTo.axis.y.getScrolledOffsetFixedStart()));
pos = mexui.util.addVec2(pos, toVector2(-this.boundTo.axis.x.getScrolledOffsetFixedStart(), -this.boundTo.axis.y.getScrolledOffsetFixedStart()));
return pos;
};
@@ -112,7 +112,7 @@ mexui.Component.Control.prototype.isInsideBoundControl = function()
mexui.Component.Control.prototype.isInsideBoundControlEntries = function()
{
var boundToControlPosition = mexui.util.addVec2(this.boundTo.getScreenPosition(), this.boundTo.entriesPositionOffset);
var boundToControlSize = new Vec2(this.boundTo.size.x, this.boundTo.axis.y.getDisplayedEntriesLength());
var boundToControlSize = toVector2(this.boundTo.size.x, this.boundTo.axis.y.getDisplayedEntriesLength());
return mexui.util.isRectangleInsideRectangle(this.getScreenPosition(), this.size, boundToControlPosition, boundToControlSize);
};

View File

@@ -3,15 +3,15 @@ mexui.Component.Window = function(x, y, w, h, title, styles)
mexui.Entity.Component.call(this, true);
mexui.Entity.StyleableEntity.call(this, this.linkComponentStyles('Window', styles));
this.position = new Vec2(x, y);
this.size = new Vec2(w, h);
this.position = toVector2(x, y);
this.size = toVector2(w, h);
this.title = title || '';
this.controls = [];
this.titleBarShown = true;
this.titleBarHeight = 30;
this.titleBarIconShown = true;
this.titleBarIconSize = new Vec2(30, 30);
this.titleBarIconSize = toVector2(30, 30);
};
mexui.util.extend(mexui.Component.Window, mexui.Entity.Component);
@@ -133,8 +133,8 @@ mexui.Component.Window.prototype.render = function()
if(this.titleBarShown)
{
// window title bar
mexui.native.drawRectangle(this.position, new Vec2(this.size.x, this.titleBarHeight), this.getStyles('title'));
mexui.native.drawText(this.position, new Vec2(this.size.x, this.titleBarHeight), this.title, this.getStyles('title'));
mexui.native.drawRectangle(this.position, toVector2(this.size.x, this.titleBarHeight), this.getStyles('title'));
mexui.native.drawText(this.position, toVector2(this.size.x, this.titleBarHeight), this.title, this.getStyles('title'));
if(this.titleBarIconShown)
{
@@ -211,7 +211,7 @@ mexui.Component.Window.prototype.isCursorOverCloseIcon = function()
mexui.Component.Window.prototype.getCloseIconPosition = function()
{
return new Vec2(this.position.x + (this.size.x - this.titleBarIconSize.x), this.position.y);
return toVector2(this.position.x + (this.size.x - this.titleBarIconSize.x), this.position.y);
};
mexui.Component.Window.prototype.triggerEvent = function(eventName, e, data, callBaseMethodFirst)
@@ -365,14 +365,14 @@ mexui.Component.Window.prototype.line = function(x, y, w, h, styles, callback)
mexui.Component.Window.prototype.list = function(x, y, w, h, styles, callback) { return this.addControl(new mexui.Control.List(this, x, y, w, h, styles, callback)); };
mexui.Component.Window.prototype.minute = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Minute(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.month = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Month(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.number = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Number(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.number = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.toInteger(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.password = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Password(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.positiveInteger = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.PositiveInteger(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.positiveNumber = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.PositiveNumber(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.positiveNumber = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.PositivetoInteger(this, x, y, w, h, text, styles, callback)); };
mexui.Component.Window.prototype.progressBar = function(x, y, w, h, text, styles) { return this.addControl(new mexui.Control.ProgressBar(this, x, y, w, h, text, styles)); };
mexui.Component.Window.prototype.radioButton = function(x, y, w, h, text, groupId, styles, callback) { return this.addControl(new mexui.Control.RadioButton(this, x, y, w, h, text, groupId, styles, callback)); };
mexui.Component.Window.prototype.rangedInteger = function(x, y, w, h, text, min, max, styles, callback) { return this.addControl(new mexui.Control.RangedInteger(this, x, y, w, h, text, min, max, styles, callback)); };
mexui.Component.Window.prototype.rangedNumber = function(x, y, w, h, text, min, max, styles, callback) { return this.addControl(new mexui.Control.RangedNumber(this, x, y, w, h, text, min, max, styles, callback)); };
mexui.Component.Window.prototype.rangedNumber = function(x, y, w, h, text, min, max, styles, callback) { return this.addControl(new mexui.Control.RangedtoInteger(this, x, y, w, h, text, min, max, styles, callback)); };
mexui.Component.Window.prototype.rectangle = function(x, y, w, h, styles, callback) { return this.addControl(new mexui.Control.Rectangle(this, x, y, w, h, styles, callback)); };
mexui.Component.Window.prototype.scrollBar = function(x, y, w, h, isVertical, styles, callback) { return this.addControl(new mexui.Control.ScrollBar(this, x, y, w, h, isVertical, styles, callback)); };
mexui.Component.Window.prototype.second = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Second(this, x, y, w, h, text, styles, callback)); };