diff --git a/third-party/mexui/Core/Component/Control.js b/third-party/mexui/Core/Component/Control.js index 7d87f0c9..c745e682 100644 --- a/third-party/mexui/Core/Component/Control.js +++ b/third-party/mexui/Core/Component/Control.js @@ -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); }; diff --git a/third-party/mexui/Core/Component/Window.js b/third-party/mexui/Core/Component/Window.js index 242468b2..2f6cea5a 100644 --- a/third-party/mexui/Core/Component/Window.js +++ b/third-party/mexui/Core/Component/Window.js @@ -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)); }; diff --git a/third-party/mexui/Core/Control/Button.js b/third-party/mexui/Core/Control/Button.js index 83116e04..ef89836c 100644 --- a/third-party/mexui/Core/Control/Button.js +++ b/third-party/mexui/Core/Control/Button.js @@ -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')); }; \ No newline at end of file diff --git a/third-party/mexui/Core/Control/CheckBox.js b/third-party/mexui/Core/Control/CheckBox.js index b02e99ef..9404463a 100644 --- a/third-party/mexui/Core/Control/CheckBox.js +++ b/third-party/mexui/Core/Control/CheckBox.js @@ -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() diff --git a/third-party/mexui/Core/Control/Date.js b/third-party/mexui/Core/Control/Date.js index 5c0dcb13..585a045d 100644 --- a/third-party/mexui/Core/Control/Date.js +++ b/third-party/mexui/Core/Control/Date.js @@ -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) { diff --git a/third-party/mexui/Core/Control/DropDown.js b/third-party/mexui/Core/Control/DropDown.js index e13d183a..ac394e3e 100644 --- a/third-party/mexui/Core/Control/DropDown.js +++ b/third-party/mexui/Core/Control/DropDown.js @@ -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); diff --git a/third-party/mexui/Core/Control/Grid.js b/third-party/mexui/Core/Control/Grid.js index 35df87cf..6d7a126d 100644 --- a/third-party/mexui/Core/Control/Grid.js +++ b/third-party/mexui/Core/Control/Grid.js @@ -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= firstArrowStartPos.x && cursorPos.y >= firstArrowStartPos.y && cursorPos.x <= lastArrowEndPos.x && cursorPos.y <= lastArrowEndPos.y) { diff --git a/third-party/mexui/Core/Control/Tree.js b/third-party/mexui/Core/Control/Tree.js index 5e17d745..a6e5d56b 100644 --- a/third-party/mexui/Core/Control/Tree.js +++ b/third-party/mexui/Core/Control/Tree.js @@ -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); diff --git a/third-party/mexui/Core/Entity/Component.js b/third-party/mexui/Core/Entity/Component.js index 3d3e7ce9..e0afae23 100644 --- a/third-party/mexui/Core/Entity/Component.js +++ b/third-party/mexui/Core/Entity/Component.js @@ -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; } }; diff --git a/third-party/mexui/Core/Entity/ControlAxis.js b/third-party/mexui/Core/Entity/ControlAxis.js index 80e9749f..4bddcdec 100644 --- a/third-party/mexui/Core/Entity/ControlAxis.js +++ b/third-party/mexui/Core/Entity/ControlAxis.js @@ -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(); diff --git a/third-party/mexui/Core/Entity/ControlWithEntries.js b/third-party/mexui/Core/Entity/ControlWithEntries.js index 5decf22f..732014ff 100644 --- a/third-party/mexui/Core/Entity/ControlWithEntries.js +++ b/third-party/mexui/Core/Entity/ControlWithEntries.js @@ -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); diff --git a/third-party/mexui/Core/Native.js b/third-party/mexui/Core/Native.js index ab0dcc45..55c24764 100644 --- a/third-party/mexui/Core/Native.js +++ b/third-party/mexui/Core/Native.js @@ -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); }; diff --git a/third-party/mexui/Core/Utility.js b/third-party/mexui/Core/Utility.js index d1415b69..25098920 100644 --- a/third-party/mexui/Core/Utility.js +++ b/third-party/mexui/Core/Utility.js @@ -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) { diff --git a/third-party/mexui/Images/down-arrow-bak.png b/third-party/mexui/Images/down-arrow-bak.png deleted file mode 100644 index 63fe7a57..00000000 Binary files a/third-party/mexui/Images/down-arrow-bak.png and /dev/null differ diff --git a/third-party/mexui/mexui.js b/third-party/mexui/mexui.js index 07621ceb..26119884 100644 --- a/third-party/mexui/mexui.js +++ b/third-party/mexui/mexui.js @@ -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); + } };