Update MexUI
This commit is contained in:
8
third-party/mexui/Core/Component/Control.js
vendored
8
third-party/mexui/Core/Component/Control.js
vendored
@@ -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 = toVector2(x, y);
|
||||
this.size = toVector2(w, h);
|
||||
this.position = new Vec2(x, y);
|
||||
this.size = new Vec2(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, toVector2(-this.boundTo.axis.x.getScrolledOffsetFixedStart(), -this.boundTo.axis.y.getScrolledOffsetFixedStart()));
|
||||
pos = mexui.util.addVec2(pos, new Vec2(-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 = toVector2(this.boundTo.size.x, this.boundTo.axis.y.getDisplayedEntriesLength());
|
||||
var boundToControlSize = new Vec2(this.boundTo.size.x, this.boundTo.axis.y.getDisplayedEntriesLength());
|
||||
return mexui.util.isRectangleInsideRectangle(this.getScreenPosition(), this.size, boundToControlPosition, boundToControlSize);
|
||||
};
|
||||
|
||||
|
||||
18
third-party/mexui/Core/Component/Window.js
vendored
18
third-party/mexui/Core/Component/Window.js
vendored
@@ -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 = toVector2(x, y);
|
||||
this.size = toVector2(w, h);
|
||||
this.position = new Vec2(x, y);
|
||||
this.size = new Vec2(w, h);
|
||||
this.title = title || '';
|
||||
|
||||
this.controls = [];
|
||||
this.titleBarShown = true;
|
||||
this.titleBarHeight = 30;
|
||||
this.titleBarIconShown = true;
|
||||
this.titleBarIconSize = toVector2(30, 30);
|
||||
this.titleBarIconSize = new Vec2(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, 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'));
|
||||
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'));
|
||||
|
||||
if(this.titleBarIconShown)
|
||||
{
|
||||
@@ -211,7 +211,7 @@ mexui.Component.Window.prototype.isCursorOverCloseIcon = function()
|
||||
|
||||
mexui.Component.Window.prototype.getCloseIconPosition = function()
|
||||
{
|
||||
return toVector2(this.position.x + (this.size.x - this.titleBarIconSize.x), this.position.y);
|
||||
return new Vec2(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.toInteger(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.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.PositivetoInteger(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.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.RangedtoInteger(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.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)); };
|
||||
|
||||
2
third-party/mexui/Core/Control/Button.js
vendored
2
third-party/mexui/Core/Control/Button.js
vendored
@@ -36,5 +36,5 @@ mexui.Control.Button.prototype.render = function()
|
||||
mexui.native.drawText(pos, this.size, this.text, this.getStyles('main'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
8
third-party/mexui/Core/Control/CheckBox.js
vendored
8
third-party/mexui/Core/Control/CheckBox.js
vendored
@@ -46,19 +46,19 @@ mexui.Control.CheckBox.prototype.render = function()
|
||||
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
|
||||
|
||||
if(this.checked)
|
||||
mexui.native.drawRectangle(mexui.util.addVec2(pos, toVector2(1, 1)), toVector2(this.size.x - 2, this.size.y - 2), this.getStyles('innerBox'));
|
||||
mexui.native.drawRectangle(mexui.util.addVec2(pos, new Vec2(1, 1)), new Vec2(this.size.x - 2, this.size.y - 2), this.getStyles('innerBox'));
|
||||
|
||||
mexui.native.drawText(mexui.util.addVec2(pos, toVector2(this.size.x + this.textMarginLeft, 2)), this.size, this.text, this.getStyles('main'));
|
||||
mexui.native.drawText(mexui.util.addVec2(pos, new Vec2(this.size.x + this.textMarginLeft, 2)), this.size, this.text, this.getStyles('main'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
// model
|
||||
mexui.Control.CheckBox.prototype.getSizeForInput = function()
|
||||
{
|
||||
var textWidth = mexui.native.getTextWidth(this.text, this.getStyles('main'));
|
||||
return toVector2(this.size.x + this.textMarginLeft + textWidth, this.size.y);
|
||||
return new Vec2(this.size.x + this.textMarginLeft + textWidth, this.size.y);
|
||||
};
|
||||
|
||||
mexui.Control.CheckBox.prototype.toggleChecked = function()
|
||||
|
||||
12
third-party/mexui/Core/Control/Date.js
vendored
12
third-party/mexui/Core/Control/Date.js
vendored
@@ -7,8 +7,8 @@ mexui.util.createControlConstructor('Date', false, function(window, x, y, w, h,
|
||||
this.year = 2019;
|
||||
|
||||
this.inputShown = false;
|
||||
this.valueBoxSize = toVector2(50, 30);
|
||||
this.arrowBoxSize = toVector2(25, 22);
|
||||
this.valueBoxSize = new Vec2(50, 30);
|
||||
this.arrowBoxSize = new Vec2(25, 22);
|
||||
|
||||
this.maxYearOffset = 10;
|
||||
this.minYearCallback = ()=>{ return 1900; };
|
||||
@@ -92,7 +92,7 @@ mexui.Control.Date.prototype.renderAfter = function()
|
||||
|
||||
var screenPos = this.getScreenPosition();
|
||||
|
||||
var pos = toVector2(screenPos.x, screenPos.y);
|
||||
var pos = new Vec2(screenPos.x, screenPos.y);
|
||||
for(var i=0; i<3; i++)
|
||||
{
|
||||
mexui.native.drawRectangle(pos, this.valueBoxSize, this.getStyles('main'));
|
||||
@@ -101,7 +101,7 @@ mexui.Control.Date.prototype.renderAfter = function()
|
||||
pos.x += this.valueBoxSize.x;
|
||||
}
|
||||
|
||||
pos = toVector2(screenPos.x, screenPos.y);
|
||||
pos = new Vec2(screenPos.x, screenPos.y);
|
||||
pos.y += this.valueBoxSize.y;
|
||||
for(var i=0; i<3; i++)
|
||||
{
|
||||
@@ -168,8 +168,8 @@ mexui.Control.Date.prototype.getArrowIndexByCursor = function()
|
||||
var cursorPos = gui.cursorPosition;
|
||||
|
||||
var screenPos = this.getScreenPosition();
|
||||
var firstArrowStartPos = toVector2(screenPos.x, screenPos.y + this.valueBoxSize.y);
|
||||
var lastArrowEndPos = toVector2(screenPos.x + (this.arrowBoxSize.x * 6), screenPos.y + this.valueBoxSize.y + this.arrowBoxSize.y);
|
||||
var firstArrowStartPos = new Vec2(screenPos.x, screenPos.y + this.valueBoxSize.y);
|
||||
var lastArrowEndPos = new Vec2(screenPos.x + (this.arrowBoxSize.x * 6), screenPos.y + this.valueBoxSize.y + this.arrowBoxSize.y);
|
||||
|
||||
if(cursorPos.x >= firstArrowStartPos.x && cursorPos.y >= firstArrowStartPos.y && cursorPos.x <= lastArrowEndPos.x && cursorPos.y <= lastArrowEndPos.y)
|
||||
{
|
||||
|
||||
12
third-party/mexui/Core/Control/DropDown.js
vendored
12
third-party/mexui/Core/Control/DropDown.js
vendored
@@ -1,7 +1,7 @@
|
||||
mexui.util.createControlConstructor('DropDown', true, function(window, x, y, w, h, text, styles, callback)
|
||||
{
|
||||
mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('DropDown', styles), callback);
|
||||
mexui.Entity.ControlWithEntries.call(this, true, true, toVector2(0, h), toVector2(w + 120, 25));
|
||||
mexui.Entity.ControlWithEntries.call(this, true, true, new Vec2(0, h), new Vec2(w + 120, 25));
|
||||
|
||||
this.axis.y.entriesShown = false;
|
||||
|
||||
@@ -89,14 +89,14 @@ mexui.Control.DropDown.prototype.render = function()
|
||||
|
||||
if(this.arrowShown)
|
||||
{
|
||||
var pos2 = toVector2(pos.x + this.size.x - (25 + 3), pos.y + 0);
|
||||
mexui.native.drawImage(pos2, toVector2(25, 25), mexui.images.downArrow, this.getStyles('main'));
|
||||
var pos2 = new Vec2(pos.x + this.size.x - (25 + 3), pos.y + 0);
|
||||
mexui.native.drawImage(pos2, new Vec2(25, 25), mexui.images.downArrow, this.getStyles('main'));
|
||||
}
|
||||
|
||||
mexui.Entity.ControlWithEntries.prototype.render.call(this);
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
mexui.Control.DropDown.prototype.renderAfter = function()
|
||||
@@ -104,7 +104,7 @@ mexui.Control.DropDown.prototype.renderAfter = function()
|
||||
if(this.axis.y.entriesShown)
|
||||
{
|
||||
var pos = this.getScreenPosition();
|
||||
var pos2 = toVector2(pos.x, pos.y);
|
||||
var pos2 = new Vec2(pos.x, pos.y);
|
||||
|
||||
pos.x += this.entriesPositionOffset.x;
|
||||
pos.y += this.entriesPositionOffset.y;
|
||||
@@ -127,7 +127,7 @@ mexui.Control.DropDown.prototype.renderAfter = function()
|
||||
}
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,toVector2(2,2)), mexui.util.addVec2(toVector2(this.entrySize.x,this.axis.y.getDisplayedEntriesLength()),toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,new Vec2(2,2)), mexui.util.addVec2(new Vec2(this.entrySize.x,this.axis.y.getDisplayedEntriesLength()),new Vec2(3,3)), this.getStyles('focused'));
|
||||
}
|
||||
|
||||
mexui.Entity.ControlWithEntries.prototype.renderAfter.call(this);
|
||||
|
||||
16
third-party/mexui/Core/Control/Grid.js
vendored
16
third-party/mexui/Core/Control/Grid.js
vendored
@@ -1,7 +1,7 @@
|
||||
mexui.util.createControlConstructor('Grid', true, function(window, x, y, w, h, styles)
|
||||
{
|
||||
mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Grid', styles));
|
||||
mexui.Entity.ControlWithEntries.call(this, false, false, toVector2(0, 25), toVector2(this.size.x, 25), toVector2(0, -25));
|
||||
mexui.Entity.ControlWithEntries.call(this, false, false, new Vec2(0, 25), new Vec2(this.size.x, 25), new Vec2(0, -25));
|
||||
});
|
||||
|
||||
// default styles
|
||||
@@ -39,10 +39,10 @@ mexui.Control.Grid.prototype.render = function()
|
||||
{
|
||||
var column = this.axis.x.entries[i];
|
||||
|
||||
mexui.native.drawText(toVector2(startX, pos.y), toVector2(column.width, column.height), column.text, this.getStyles('header'));
|
||||
mexui.native.drawText(new Vec2(startX, pos.y), new Vec2(column.width, column.height), column.text, this.getStyles('header'));
|
||||
|
||||
startX += column.width;
|
||||
mexui.native.drawAALine(toVector2(startX, pos.y), toVector2(startX, pos.y + this.size.y), this.getStyles('column'));
|
||||
mexui.native.drawAALine(new Vec2(startX, pos.y), new Vec2(startX, pos.y + this.size.y), this.getStyles('column'));
|
||||
|
||||
if(column.height > maxColumnHeight)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ mexui.Control.Grid.prototype.render = function()
|
||||
}
|
||||
|
||||
var startY = pos.y + maxColumnHeight;
|
||||
mexui.native.drawAALine(toVector2(pos.x, startY), toVector2(pos.x + this.size.x, startY), this.getStyles('row'));
|
||||
mexui.native.drawAALine(new Vec2(pos.x, startY), new Vec2(pos.x + this.size.x, startY), this.getStyles('row'));
|
||||
|
||||
for(var i=this.axis.y.getEntryStartIndex(),j=this.axis.y.getEntryEndIndex(); i<j; i++)
|
||||
{
|
||||
@@ -68,18 +68,18 @@ mexui.Control.Grid.prototype.render = function()
|
||||
|
||||
var styles = this.getEntryStyles([[cell,'main'], [row,'main'], [this,'row'], [this,'cell']]);
|
||||
|
||||
mexui.native.drawRectangle(toVector2(startX, startY), toVector2(column.width, column.height), styles);
|
||||
mexui.native.drawText(toVector2(startX, startY), toVector2(column.width, column.height), cellText, styles);
|
||||
mexui.native.drawRectangle(new Vec2(startX, startY), new Vec2(column.width, column.height), styles);
|
||||
mexui.native.drawText(new Vec2(startX, startY), new Vec2(column.width, column.height), cellText, styles);
|
||||
|
||||
startX += column.width;
|
||||
}
|
||||
|
||||
startY += row.rowHeight;
|
||||
mexui.native.drawAALine(toVector2(pos.x, startY), toVector2(pos.x + this.size.x, startY), this.getStyles('row'));
|
||||
mexui.native.drawAALine(new Vec2(pos.x, startY), new Vec2(pos.x + this.size.x, startY), this.getStyles('row'));
|
||||
}
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
// model
|
||||
|
||||
2
third-party/mexui/Core/Control/Image.js
vendored
2
third-party/mexui/Core/Control/Image.js
vendored
@@ -16,5 +16,5 @@ mexui.Control.Image.prototype.render = function()
|
||||
mexui.native.drawImage(pos, this.size, this.image, this.getStyles('main'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
10
third-party/mexui/Core/Control/List.js
vendored
10
third-party/mexui/Core/Control/List.js
vendored
@@ -34,22 +34,22 @@ mexui.Control.List.prototype.onMouseDown = function(e)
|
||||
mexui.Control.List.prototype.render = function()
|
||||
{
|
||||
var pos = this.getScreenPosition();
|
||||
var pos2 = toVector2(pos.x, pos.y);
|
||||
var pos2 = new Vec2(pos.x, pos.y);
|
||||
|
||||
for(var i in this.axis.y.entries)
|
||||
{
|
||||
var row = this.axis.y.entries[i];
|
||||
var rowText = row.text;
|
||||
|
||||
mexui.native.drawRectangle(pos, toVector2(this.size.x, this.rowHeight), this.getStyles('row'));
|
||||
mexui.native.drawText(pos, toVector2(this.size.x, this.rowHeight), rowText, this.getStyles('row'));
|
||||
mexui.native.drawRectangle(pos, new Vec2(this.size.x, this.rowHeight), this.getStyles('row'));
|
||||
mexui.native.drawText(pos, new Vec2(this.size.x, this.rowHeight), rowText, this.getStyles('row'));
|
||||
|
||||
pos.y += this.rowHeight;
|
||||
mexui.native.drawAALine(pos, toVector2(pos.x + this.size.x, pos.y), this.getStyles('rowLine'));
|
||||
mexui.native.drawAALine(pos, new Vec2(pos.x + this.size.x, pos.y), this.getStyles('rowLine'));
|
||||
}
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
// model
|
||||
|
||||
@@ -27,7 +27,7 @@ mexui.Control.ProgressBar.prototype.render = function()
|
||||
|
||||
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
|
||||
|
||||
var innerBarSize = toVector2(this.size.x * this.progress, this.size.y);
|
||||
var innerBarSize = new Vec2(this.size.x * this.progress, this.size.y);
|
||||
mexui.native.drawRectangle(pos, innerBarSize, this.getStyles('innerBar'));
|
||||
|
||||
if(this.text != '')
|
||||
|
||||
@@ -46,19 +46,19 @@ mexui.Control.RadioButton.prototype.render = function()
|
||||
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
|
||||
|
||||
if(this.checked)
|
||||
mexui.native.drawRectangle(mexui.util.addVec2(pos, toVector2(2, 2)), toVector2(this.size.x - 4, this.size.y - 4), this.getStyles('innerBox'));
|
||||
mexui.native.drawRectangle(mexui.util.addVec2(pos, new Vec2(2, 2)), new Vec2(this.size.x - 4, this.size.y - 4), this.getStyles('innerBox'));
|
||||
|
||||
mexui.native.drawText(mexui.util.addVec2(pos, toVector2(this.size.x + this.textMarginLeft, 2)), this.size, this.text, this.getStyles('main'));
|
||||
mexui.native.drawText(mexui.util.addVec2(pos, new Vec2(this.size.x + this.textMarginLeft, 2)), this.size, this.text, this.getStyles('main'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
// model
|
||||
mexui.Control.RadioButton.prototype.getSizeForInput = function()
|
||||
{
|
||||
var textWidth = mexui.native.getTextWidth(this.text, this.getStyles('main'));
|
||||
return toVector2(this.size.x + this.textMarginLeft + textWidth, this.size.y);
|
||||
return new Vec2(this.size.x + this.textMarginLeft + textWidth, this.size.y);
|
||||
};
|
||||
|
||||
mexui.Control.RadioButton.prototype.getGroupRadios = function()
|
||||
|
||||
4
third-party/mexui/Core/Control/ScrollBar.js
vendored
4
third-party/mexui/Core/Control/ScrollBar.js
vendored
@@ -99,7 +99,7 @@ mexui.Control.ScrollBar.prototype.clampScrolledRatio = function()
|
||||
mexui.Control.ScrollBar.prototype.getInnerBarPosition = function()
|
||||
{
|
||||
var screenPos = this.getScreenPosition();
|
||||
var pos = toVector2(screenPos.x, screenPos.y);
|
||||
var pos = new Vec2(screenPos.x, screenPos.y);
|
||||
|
||||
var minPos = pos[this.axisIndex] + 1;
|
||||
var maxPos = pos[this.axisIndex] + this.size[this.axisIndex] - 2;
|
||||
@@ -110,7 +110,7 @@ mexui.Control.ScrollBar.prototype.getInnerBarPosition = function()
|
||||
|
||||
mexui.Control.ScrollBar.prototype.getInnerBarSize = function()
|
||||
{
|
||||
var size = toVector2(this.size.x, this.size.y);
|
||||
var size = new Vec2(this.size.x, this.size.y);
|
||||
size[this.axisIndex] = this.barHigherLength;
|
||||
size[this.otherAxisIndex] -= 2;
|
||||
return size;
|
||||
|
||||
8
third-party/mexui/Core/Control/Slider.js
vendored
8
third-party/mexui/Core/Control/Slider.js
vendored
@@ -14,7 +14,7 @@ mexui.util.createControlConstructor('Slider', false, function(window, x, y, w, h
|
||||
|
||||
this.progress = 0.0;
|
||||
this.axisIndex = isVertical ? 1 : 0;
|
||||
this.innerBarSize = toVector2(30, 25);
|
||||
this.innerBarSize = new Vec2(30, 25);
|
||||
});
|
||||
|
||||
// default styles
|
||||
@@ -67,7 +67,7 @@ mexui.Control.Slider.prototype.onMouseMove = function(e, offset)
|
||||
mexui.Control.Slider.prototype.render = function()
|
||||
{
|
||||
var pos = this.getScreenPosition();
|
||||
var pos2 = toVector2(pos.x, pos.y);
|
||||
var pos2 = new Vec2(pos.x, pos.y);
|
||||
|
||||
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
|
||||
mexui.native.drawRectangle(this.getInnerBarPosition(), this.innerBarSize, this.getStyles('innerBar'));
|
||||
@@ -84,7 +84,7 @@ mexui.Control.Slider.prototype.render = function()
|
||||
mexui.native.drawText(pos, this.size, this.maxText, this.getStyles('maxText'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
// model
|
||||
@@ -98,7 +98,7 @@ mexui.Control.Slider.prototype.getInnerBarPosition = function()
|
||||
var pos = this.getScreenPosition();
|
||||
pos[this.axisIndex] = mexui.util.interpolateScalar(pos.x, (pos.x + this.size.x) - this.innerBarSize.x, this.progress);
|
||||
pos.y -= 3;
|
||||
return toVector2(pos.x, pos.y);
|
||||
return new Vec2(pos.x, pos.y);
|
||||
};
|
||||
|
||||
mexui.Control.Slider.prototype.getProgressIncreaseByPixels = function(offset)
|
||||
|
||||
10
third-party/mexui/Core/Control/TabPanel.js
vendored
10
third-party/mexui/Core/Control/TabPanel.js
vendored
@@ -35,8 +35,8 @@ mexui.Control.TabPanel.prototype.onMouseDown = function(e)
|
||||
{
|
||||
var tab = this.axis.x.entries[i];
|
||||
|
||||
var tabPos = toVector2(tabX, pos.y);
|
||||
var tabSize = toVector2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
|
||||
var tabPos = new Vec2(tabX, pos.y);
|
||||
var tabSize = new Vec2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
|
||||
|
||||
if(mexui.util.isCursorInRectangle(tabPos, tabSize))
|
||||
{
|
||||
@@ -67,8 +67,8 @@ mexui.Control.TabPanel.prototype.render = function()
|
||||
{
|
||||
var tab = this.axis.x.entries[i];
|
||||
|
||||
var tabPos = toVector2(tabX, pos.y);
|
||||
var tabSize = toVector2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
|
||||
var tabPos = new Vec2(tabX, pos.y);
|
||||
var tabSize = new Vec2(mexui.native.getTextWidth(tab.text, this.getStyles('tab')) + 10, 25);
|
||||
mexui.native.drawRectangle(tabPos, tabSize, this.getStyles('tab'));
|
||||
mexui.native.drawText(tabPos, tabSize, tab.text, this.getStyles('tab'));
|
||||
|
||||
@@ -76,7 +76,7 @@ mexui.Control.TabPanel.prototype.render = function()
|
||||
}
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
// model
|
||||
|
||||
2
third-party/mexui/Core/Control/Text.js
vendored
2
third-party/mexui/Core/Control/Text.js
vendored
@@ -16,5 +16,5 @@ mexui.Control.Text.prototype.render = function()
|
||||
mexui.native.drawText(pos, this.size, this.text, this.getStyles('main'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
18
third-party/mexui/Core/Control/TextInput.js
vendored
18
third-party/mexui/Core/Control/TextInput.js
vendored
@@ -8,7 +8,7 @@ mexui.util.createControlConstructor('TextInput', false, function(window, x, y, w
|
||||
|
||||
this.lines = text ? mexui.util.splitLines(text) : [''];
|
||||
|
||||
this.caretPosition = toVector2(0, 0);
|
||||
this.caretPosition = new Vec2(0, 0);
|
||||
this.multiLineSupported = multiLineSupported === undefined ? true : multiLineSupported;
|
||||
this.multiLine = this.multiLineSupported ? mexui.util.doesContainEOLChar(text) : false;
|
||||
this.masked = false;
|
||||
@@ -143,7 +143,7 @@ mexui.Control.TextInput.prototype.onKeyDown = function(e, key, mods)
|
||||
case SDLK_BACKSPACE:
|
||||
if(this.caretPosition.x != 0)
|
||||
{
|
||||
this.deleteCharacter(toVector2(this.caretPosition.x - 1, this.caretPosition.y));
|
||||
this.deleteCharacter(new Vec2(this.caretPosition.x - 1, this.caretPosition.y));
|
||||
this.caretPosition.x--;
|
||||
this.checkToCallCallback();
|
||||
}
|
||||
@@ -207,7 +207,7 @@ mexui.Control.TextInput.prototype.onKeyDown = function(e, key, mods)
|
||||
mexui.Control.TextInput.prototype.render = function()
|
||||
{
|
||||
var pos = this.getScreenPosition();
|
||||
var pos2 = toVector2(pos.x, pos.y);
|
||||
var pos2 = new Vec2(pos.x, pos.y);
|
||||
|
||||
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
|
||||
|
||||
@@ -217,7 +217,7 @@ mexui.Control.TextInput.prototype.render = function()
|
||||
}
|
||||
else
|
||||
{
|
||||
var lineSize = toVector2(this.size.x, this.lineHeight);
|
||||
var lineSize = new Vec2(this.size.x, this.lineHeight);
|
||||
for(var i=0,j=this.lines.length; i<j; i++)
|
||||
{
|
||||
var displayedText = this.masked ? '*'.repeat(this.lines[i].length) : this.lines[i];
|
||||
@@ -232,7 +232,7 @@ mexui.Control.TextInput.prototype.render = function()
|
||||
if(this.isFocused())
|
||||
{
|
||||
if(!valueIsInvalid)
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
|
||||
if(this.caretShownForBlink)
|
||||
{
|
||||
@@ -240,15 +240,15 @@ mexui.Control.TextInput.prototype.render = function()
|
||||
var text = this.lines[this.caretPosition.y].substr(0, this.caretPosition.x);
|
||||
var displayedText = this.masked ? '*'.repeat(text.length) : text;
|
||||
var textWidth = mexui.native.getTextWidth(displayedText, this.getStyles('main'));
|
||||
var caretPosOffset = toVector2(5 + textWidth, (this.caretPosition.y * this.lineHeight) + 1);
|
||||
var caretPosOffset = new Vec2(5 + textWidth, (this.caretPosition.y * this.lineHeight) + 1);
|
||||
var caretPoint1 = mexui.util.addVec2(pos, caretPosOffset);
|
||||
var caretPoint2 = toVector2(caretPoint1.x, caretPoint1.y + 22);
|
||||
var caretPoint2 = new Vec2(caretPoint1.x, caretPoint1.y + 22);
|
||||
mexui.native.drawAALine(caretPoint1, caretPoint2, this.getStyles('caret'));
|
||||
}
|
||||
}
|
||||
|
||||
if(valueIsInvalid)
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('invalidValue'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos2,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('invalidValue'));
|
||||
};
|
||||
|
||||
// model
|
||||
@@ -280,7 +280,7 @@ mexui.Control.TextInput.prototype.getCaretPositionByCursor = function()
|
||||
{
|
||||
var lineIndex = this.getCaretLineIndexByCursor();
|
||||
var charIndex = this.getCharIndexByCursor(lineIndex);
|
||||
return toVector2(charIndex, lineIndex);
|
||||
return new Vec2(charIndex, lineIndex);
|
||||
};
|
||||
|
||||
mexui.Control.TextInput.prototype.getCaretLineIndexByCursor = function()
|
||||
|
||||
12
third-party/mexui/Core/Control/Time.js
vendored
12
third-party/mexui/Core/Control/Time.js
vendored
@@ -7,8 +7,8 @@ mexui.util.createControlConstructor('Time', false, function(window, x, y, w, h,
|
||||
this.second = 0;
|
||||
|
||||
this.inputShown = false;
|
||||
this.valueBoxSize = toVector2(50, 30);
|
||||
this.arrowBoxSize = toVector2(25, 22);
|
||||
this.valueBoxSize = new Vec2(50, 30);
|
||||
this.arrowBoxSize = new Vec2(25, 22);
|
||||
});
|
||||
mexui.util.extend(mexui.Control.Time, mexui.Control.TextInput);
|
||||
|
||||
@@ -74,7 +74,7 @@ mexui.Control.Time.prototype.renderAfter = function()
|
||||
|
||||
var screenPos = this.getScreenPosition();
|
||||
|
||||
var pos = toVector2(screenPos.x, screenPos.y);
|
||||
var pos = new Vec2(screenPos.x, screenPos.y);
|
||||
for(var i=0; i<3; i++)
|
||||
{
|
||||
mexui.native.drawRectangle(pos, this.valueBoxSize, this.getStyles('main'));
|
||||
@@ -83,7 +83,7 @@ mexui.Control.Time.prototype.renderAfter = function()
|
||||
pos.x += this.valueBoxSize.x;
|
||||
}
|
||||
|
||||
pos = toVector2(screenPos.x, screenPos.y);
|
||||
pos = new Vec2(screenPos.x, screenPos.y);
|
||||
pos.y += this.valueBoxSize.y;
|
||||
for(var i=0; i<3; i++)
|
||||
{
|
||||
@@ -148,8 +148,8 @@ mexui.Control.Time.prototype.getArrowIndexByCursor = function()
|
||||
var cursorPos = gui.cursorPosition;
|
||||
|
||||
var screenPos = this.getScreenPosition();
|
||||
var firstArrowStartPos = toVector2(screenPos.x, screenPos.y + this.valueBoxSize.y);
|
||||
var lastArrowEndPos = toVector2(screenPos.x + (this.arrowBoxSize.x * 6), screenPos.y + this.valueBoxSize.y + this.arrowBoxSize.y);
|
||||
var firstArrowStartPos = new Vec2(screenPos.x, screenPos.y + this.valueBoxSize.y);
|
||||
var lastArrowEndPos = new Vec2(screenPos.x + (this.arrowBoxSize.x * 6), screenPos.y + this.valueBoxSize.y + this.arrowBoxSize.y);
|
||||
|
||||
if(cursorPos.x >= firstArrowStartPos.x && cursorPos.y >= firstArrowStartPos.y && cursorPos.x <= lastArrowEndPos.x && cursorPos.y <= lastArrowEndPos.y)
|
||||
{
|
||||
|
||||
14
third-party/mexui/Core/Control/Tree.js
vendored
14
third-party/mexui/Core/Control/Tree.js
vendored
@@ -49,7 +49,7 @@ mexui.Control.Tree.prototype.render = function()
|
||||
this.renderRows(this.axis.y.entries, 0, pos);
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,toVector2(2,2)), mexui.util.addVec2(this.size,toVector2(3,3)), this.getStyles('focused'));
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
|
||||
mexui.Control.Tree.prototype.renderRows = function(rows, level, pos)
|
||||
@@ -62,17 +62,17 @@ mexui.Control.Tree.prototype.renderRows = function(rows, level, pos)
|
||||
if(shouldDraw)
|
||||
{
|
||||
if(row.rows.length > 0)
|
||||
mexui.native.drawText(toVector2(pos.x - (this.rowLevelIndentation * 2), pos.y), toVector2(this.size.x, this.rowHeight), row.open ? '-' : '+', this.getStyles('rowIcon'));
|
||||
mexui.native.drawText(new Vec2(pos.x - (this.rowLevelIndentation * 2), pos.y), new Vec2(this.size.x, this.rowHeight), row.open ? '-' : '+', this.getStyles('rowIcon'));
|
||||
|
||||
mexui.native.drawRectangle(pos, toVector2(this.size.x - (this.rowLevelIndentation * level), this.rowHeight), this.getStyles('row'));
|
||||
mexui.native.drawText(pos, toVector2(this.size.x, this.rowHeight), row.text, this.getStyles('row'));
|
||||
mexui.native.drawRectangle(pos, new Vec2(this.size.x - (this.rowLevelIndentation * level), this.rowHeight), this.getStyles('row'));
|
||||
mexui.native.drawText(pos, new Vec2(this.size.x, this.rowHeight), row.text, this.getStyles('row'));
|
||||
}
|
||||
|
||||
pos.y += this.rowHeight;
|
||||
|
||||
if(shouldDraw)
|
||||
{
|
||||
mexui.native.drawAALine(pos, toVector2(pos.x + this.size.x, pos.y), this.getStyles('rowLine'));
|
||||
mexui.native.drawAALine(pos, new Vec2(pos.x + this.size.x, pos.y), this.getStyles('rowLine'));
|
||||
}
|
||||
|
||||
if(row.rows.length > 0 && row.open)
|
||||
@@ -107,8 +107,8 @@ mexui.Control.Tree.prototype.testRowClick = function(e, rows, pos)
|
||||
{
|
||||
var row = rows[i];
|
||||
|
||||
var rowPos = toVector2(pos.x - (this.rowLevelIndentation * 2), pos.y);
|
||||
var rowSize = toVector2(this.size.x + (this.rowLevelIndentation * 2), this.rowHeight);
|
||||
var rowPos = new Vec2(pos.x - (this.rowLevelIndentation * 2), pos.y);
|
||||
var rowSize = new Vec2(this.size.x + (this.rowLevelIndentation * 2), this.rowHeight);
|
||||
if(mexui.util.isCursorInRectangle(rowPos, rowSize))
|
||||
{
|
||||
this.onClickRow(row);
|
||||
|
||||
2
third-party/mexui/Core/Entity/Component.js
vendored
2
third-party/mexui/Core/Entity/Component.js
vendored
@@ -29,7 +29,7 @@ mexui.Entity.Component.prototype.onMouseMove = function(e, offset)
|
||||
{
|
||||
if(this.moving)
|
||||
{
|
||||
this.position = toVector2(this.position.x + offset.x, this.position.y + offset.y);
|
||||
this.position = new Vec2(this.position.x + offset.x, this.position.y + offset.y);
|
||||
e.used = true;
|
||||
}
|
||||
};
|
||||
|
||||
6
third-party/mexui/Core/Entity/ControlAxis.js
vendored
6
third-party/mexui/Core/Entity/ControlAxis.js
vendored
@@ -19,12 +19,12 @@ mexui.Entity.ControlAxis.prototype.initScrollBar = function()
|
||||
{
|
||||
if(this.isVertical)
|
||||
{
|
||||
var pos = mexui.util.addVec2(this.control.position, toVector2(this.control.entrySize.x, this.control.entriesPositionOffset.y));
|
||||
var pos = mexui.util.addVec2(this.control.position, new Vec2(this.control.entrySize.x, this.control.entriesPositionOffset.y));
|
||||
this.scrollBar = new mexui.Control.ScrollBar(this.control.window, pos.x, pos.y, 25, this.getDisplayedEntriesLength(), true, this.control.styles.scrollBar);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pos = mexui.util.addVec2(this.control.position, toVector2(this.control.entriesPositionOffset.x, this.control.size.y));
|
||||
var pos = mexui.util.addVec2(this.control.position, new Vec2(this.control.entriesPositionOffset.x, this.control.size.y));
|
||||
this.scrollBar = new mexui.Control.ScrollBar(this.control.window, pos.x, pos.y, this.getDisplayedEntriesLength(), 25, false, this.control.styles.scrollBar);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ mexui.Entity.ControlAxis.prototype.getEntryIndexByPoint = function(point)
|
||||
return null;
|
||||
}
|
||||
|
||||
var pos = toVector2(screenPos.x + this.control.entriesPositionOffset.x, screenPos.y + this.control.entriesPositionOffset.y);
|
||||
var pos = new Vec2(screenPos.x + this.control.entriesPositionOffset.x, screenPos.y + this.control.entriesPositionOffset.y);
|
||||
var index = Math.floor((point.y - pos.y) / this.control.entrySize[this.axisIndex]);
|
||||
index += this.getEntryStartIndex();
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
mexui.Entity.ControlWithEntries = function(entriesOutsideControl, manualScrollBar, entriesPositionOffset, entrySize, entriesSizeOffset)
|
||||
{
|
||||
this.entriesOutsideControl = entriesOutsideControl;
|
||||
this.entriesPositionOffset = entriesPositionOffset || toVector2(0, 0);
|
||||
this.entrySize = entrySize || toVector2(this.size.x, 25);
|
||||
this.entriesSizeOffset = entriesSizeOffset || toVector2(0, 0);
|
||||
this.entriesPositionOffset = entriesPositionOffset || new Vec2(0, 0);
|
||||
this.entrySize = entrySize || new Vec2(this.size.x, 25);
|
||||
this.entriesSizeOffset = entriesSizeOffset || new Vec2(0, 0);
|
||||
|
||||
this.axis = {};
|
||||
this.axis.x = new mexui.Entity.ControlAxis(this, false, manualScrollBar, entriesPositionOffset);
|
||||
|
||||
22
third-party/mexui/Core/Native.js
vendored
22
third-party/mexui/Core/Native.js
vendored
@@ -12,11 +12,11 @@ mexui.native.loadImage = function(imageFilePath, imageName)
|
||||
|
||||
var image = null;
|
||||
var parts = imageFilePath.split('.');
|
||||
var ext = toLowerCase(parts[parts.length - 1]);
|
||||
var ext = parts[parts.length - 1].toLowerCase();
|
||||
if(ext == 'png')
|
||||
image = drawing.loadPNG(file);
|
||||
image = graphics.loadPNG(file);
|
||||
else if(ext == 'bmp')
|
||||
image = drawing.loadBMP(file);
|
||||
image = graphics.loadBMP(file);
|
||||
else
|
||||
{
|
||||
console.log('ERROR [IMAGE LOAD] - Unsupported image file path extension. Currently only supports PNG or BMP.');
|
||||
@@ -93,7 +93,7 @@ mexui.native.drawRectangleBackground = function(position, size, styles)
|
||||
if(backgroundColour == null || backgroundColour == 'none')
|
||||
return;
|
||||
|
||||
drawing.drawRectangle(null, position, size, backgroundColour, backgroundColour, backgroundColour, backgroundColour);
|
||||
graphics.drawRectangle(null, position, size, backgroundColour, backgroundColour, backgroundColour, backgroundColour);
|
||||
};
|
||||
|
||||
mexui.native.drawRectangleBorder = function(position, size, styles)
|
||||
@@ -105,10 +105,10 @@ mexui.native.drawRectangleBorder = function(position, size, styles)
|
||||
var rightXPosition = position.x + size.x;
|
||||
var bottomYPosition = position.y + size.y;
|
||||
|
||||
var topLeftPosition = toVector2(position.x, position.y);
|
||||
var topRightPosition = toVector2(rightXPosition, position.y);
|
||||
var bottomLeftPosition = toVector2(position.x, bottomYPosition);
|
||||
var bottomRightPosition = toVector2(rightXPosition, bottomYPosition);
|
||||
var topLeftPosition = new Vec2(position.x, position.y);
|
||||
var topRightPosition = new Vec2(rightXPosition, position.y);
|
||||
var bottomLeftPosition = new Vec2(position.x, bottomYPosition);
|
||||
var bottomRightPosition = new Vec2(rightXPosition, bottomYPosition);
|
||||
|
||||
var original = styles.lineColour;
|
||||
|
||||
@@ -133,7 +133,7 @@ mexui.native.drawAALine = function(point1, point2, styles)
|
||||
if(lineColour == null || lineColour == 'none')
|
||||
return;
|
||||
|
||||
drawing.drawRectangle(null, point1, toVector2((point2.x - point1.x) + styles.lineWeight, (point2.y - point1.y) + styles.lineWeight), lineColour, lineColour, lineColour, lineColour);
|
||||
graphics.drawRectangle(null, point1, new Vec2((point2.x - point1.x) + styles.lineWeight, (point2.y - point1.y) + styles.lineWeight), lineColour, lineColour, lineColour, lineColour);
|
||||
};
|
||||
|
||||
mexui.native.drawText = function(position, size, text, styles)
|
||||
@@ -142,13 +142,13 @@ mexui.native.drawText = function(position, size, text, styles)
|
||||
|
||||
var textHeight = mexui.native.getTextHeight(text, styles, font);
|
||||
var textIndent = styles.textAlign == 0.0 || styles.textAlign == 1.0 ? styles.textIndent : 0;
|
||||
var textPos = toVector2(position.x + textIndent, position.y + ((size.y - textHeight) / 2.0));
|
||||
var textPos = new Vec2(position.x + textIndent, position.y + ((size.y - textHeight) / 2.0));
|
||||
|
||||
font.render(text + '', textPos, size.x, styles.textAlign, 0.0, styles.textSize, styles.textColour != null ? styles.textColour : styles.textColor);
|
||||
};
|
||||
|
||||
mexui.native.drawImage = function(position, size, image, styles)
|
||||
{
|
||||
drawing.drawRectangle(image, position, size);
|
||||
graphics.drawRectangle(image, position, size);
|
||||
};
|
||||
|
||||
|
||||
16
third-party/mexui/Core/Utility.js
vendored
16
third-party/mexui/Core/Utility.js
vendored
@@ -26,17 +26,17 @@ mexui.util.isCursorInRectangle = function(position, size)
|
||||
|
||||
mexui.util.addVec2 = function(vec2a, vec2b)
|
||||
{
|
||||
return toVector2(vec2a.x + vec2b.x, vec2a.y + vec2b.y);
|
||||
return new Vec2(vec2a.x + vec2b.x, vec2a.y + vec2b.y);
|
||||
};
|
||||
|
||||
mexui.util.subtractVec2 = function(vec2a, vec2b)
|
||||
{
|
||||
return toVector2(vec2a.x - vec2b.x, vec2a.y - vec2b.y);
|
||||
return new Vec2(vec2a.x - vec2b.x, vec2a.y - vec2b.y);
|
||||
};
|
||||
|
||||
mexui.util.addVec3 = function(vec3a, vec3b)
|
||||
{
|
||||
return toVector3(vec3a.x + vec3b.x, vec3a.y + vec3b.y, vec3a.z + vec3b.z);
|
||||
return new Vec3(vec3a.x + vec3b.x, vec3a.y + vec3b.y, vec3a.z + vec3b.z);
|
||||
};
|
||||
|
||||
mexui.util.createControlConstructor = function(controlName, hasEntries, constructor)
|
||||
@@ -228,7 +228,7 @@ mexui.util.round = function(x, n)
|
||||
|
||||
mexui.util.getCenterPosition = function(largerSize, smallerSize)
|
||||
{
|
||||
return toVector2(
|
||||
return new Vec2(
|
||||
(largerSize.x - smallerSize.x) / 2.0,
|
||||
(largerSize.y - smallerSize.y) / 2.0
|
||||
);
|
||||
@@ -236,7 +236,7 @@ mexui.util.getCenterPosition = function(largerSize, smallerSize)
|
||||
|
||||
mexui.util.getWindowSize = function()
|
||||
{
|
||||
return toVector2(gta.width, gta.height);
|
||||
return new Vec2(gta.width, gta.height);
|
||||
};
|
||||
|
||||
mexui.util.isRectangleInsideRectangle = function(pos1, size1, pos2, size2)
|
||||
@@ -543,7 +543,7 @@ mexui.util.isWeekDayName = function(text)
|
||||
|
||||
mexui.util.isDayIdSuffix = function(text)
|
||||
{
|
||||
switch(toLowerCase(text))
|
||||
switch(text.toLowerCase())
|
||||
{
|
||||
case 'st':
|
||||
case 'nd':
|
||||
@@ -556,7 +556,7 @@ mexui.util.isDayIdSuffix = function(text)
|
||||
|
||||
mexui.util.isDayIdSuffixForDayId = function(dayId, text)
|
||||
{
|
||||
switch(toLowerCase(text))
|
||||
switch(text.toLowerCase())
|
||||
{
|
||||
case 'st': return dayId == 1 || dayId == 21 || dayId == 31;
|
||||
case 'nd': return dayId == 2 || dayId == 22;
|
||||
@@ -604,7 +604,7 @@ mexui.util.isDayIdWithOptionalSuffix = function(text)
|
||||
|
||||
mexui.util.inArrayOrStartsWithInArray = function(text, arr, startsWithCharCount)
|
||||
{
|
||||
text = toLowerCase(text);
|
||||
text = text.toLowerCase();
|
||||
|
||||
for(var i in arr)
|
||||
{
|
||||
|
||||
BIN
third-party/mexui/Images/down-arrow-bak.png
vendored
BIN
third-party/mexui/Images/down-arrow-bak.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 273 B |
16
third-party/mexui/mexui.js
vendored
16
third-party/mexui/mexui.js
vendored
@@ -44,7 +44,7 @@ mexui.bindEvents = function()
|
||||
if(isAbsolute)
|
||||
return;
|
||||
|
||||
mexui.triggerEvent('onMouseMove', toVector2(position.x, position.y), true);
|
||||
mexui.triggerEvent('onMouseMove', new Vec2(position.x, position.y), true);
|
||||
});
|
||||
|
||||
addEventHandler('onMouseWheel', function(event, mouse, offset, flipped)
|
||||
@@ -287,12 +287,12 @@ mexui.isAnyWindowShown = function()
|
||||
mexui.setInput = function(showInput)
|
||||
{
|
||||
gui.showCursor(showInput, !showInput);
|
||||
//if(localPlayer)
|
||||
//{
|
||||
// if(showInput)
|
||||
// gta.setCameraLookAtEntity(toVector3(gta.cameraMatrix.m41, gta.cameraMatrix.m42, gta.cameraMatrix.m43), localPlayer, false);
|
||||
// else
|
||||
// gta.restoreCamera(false);
|
||||
//}
|
||||
if(localPlayer)
|
||||
{
|
||||
if(showInput)
|
||||
gta.setCameraLookAtEntity(new Vec3(gta.cameraMatrix.m41, gta.cameraMatrix.m42, gta.cameraMatrix.m43), localPlayer, false);
|
||||
else
|
||||
gta.restoreCamera(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user