MexUI stuff
This commit is contained in:
1
third-party/mexui/Core/Component/Control.js
vendored
1
third-party/mexui/Core/Component/Control.js
vendored
@@ -131,3 +131,4 @@ mexui.Component.Control.prototype.unbind = function()
|
|||||||
{
|
{
|
||||||
this.boundTo = null;
|
this.boundTo = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Component/Entry.js
vendored
1
third-party/mexui/Core/Component/Entry.js
vendored
@@ -29,3 +29,4 @@ mexui.Component.Entry.prototype.remove = function()
|
|||||||
this.control.axis[this.getAxisKey()].entries.splice(this.getEntryIndex(), 1);
|
this.control.axis[this.getAxisKey()].entries.splice(this.getEntryIndex(), 1);
|
||||||
this.control.checkToShowScrollBars();
|
this.control.checkToShowScrollBars();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Component/Event.js
vendored
1
third-party/mexui/Core/Component/Event.js
vendored
@@ -3,3 +3,4 @@ mexui.Component.Event = function()
|
|||||||
this.used = false;
|
this.used = false;
|
||||||
this.clickedAControl = false;
|
this.clickedAControl = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
3
third-party/mexui/Core/Component/Window.js
vendored
3
third-party/mexui/Core/Component/Window.js
vendored
@@ -355,7 +355,7 @@ mexui.Component.Window.prototype.digits = function(x, y, w, h, text, styles, c
|
|||||||
mexui.Component.Window.prototype.dropDown = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.DropDown(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.dropDown = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.DropDown(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.grid = function(x, y, w, h, styles) { return this.addControl(new mexui.Control.Grid(this, x, y, w, h, styles)); };
|
mexui.Component.Window.prototype.grid = function(x, y, w, h, styles) { return this.addControl(new mexui.Control.Grid(this, x, y, w, h, styles)); };
|
||||||
mexui.Component.Window.prototype.hour = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Hour(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.hour = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Hour(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.image = function(x, y, w, h, filePath, styles) { return this.addControl(new mexui.Control.Image(this, x, y, w, h, filePath, styles)); };
|
mexui.Component.Window.prototype.image = function(x, y, w, h, filePath, styles, callback) { return this.addControl(new mexui.Control.Image(this, x, y, w, h, filePath, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.integer = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Integer(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.integer = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Integer(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.letter = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Letter(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.letter = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Letter(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.letters = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Letters(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.letters = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Letters(this, x, y, w, h, text, styles, callback)); };
|
||||||
@@ -386,3 +386,4 @@ mexui.Component.Window.prototype.tree = function(x, y, w, h, styles, callback)
|
|||||||
mexui.Component.Window.prototype.week = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Week(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.week = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Week(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.weekDay = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.WeekDay(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.weekDay = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.WeekDay(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.year = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Year(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.year = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Year(this, x, y, w, h, text, styles, callback)); };
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Control/Grid.js
vendored
1
third-party/mexui/Core/Control/Grid.js
vendored
@@ -127,3 +127,4 @@ mexui.Control.Grid.prototype.getAllEntriesLength = function(axisIndex)
|
|||||||
return this.axis.y.getAllEntriesLength2();
|
return this.axis.y.getAllEntriesLength2();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
33
third-party/mexui/Core/Control/Image.js
vendored
33
third-party/mexui/Core/Control/Image.js
vendored
@@ -1,6 +1,6 @@
|
|||||||
mexui.util.createControlConstructor('Image', false, function(window, x, y, w, h, filePath, styles)
|
mexui.util.createControlConstructor('Image', false, function(window, x, y, w, h, filePath, styles, callback)
|
||||||
{
|
{
|
||||||
mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Image', styles));
|
mexui.Component.Control.call(this, window, x, y, w, h, this.linkControlStyles('Image', styles), callback);
|
||||||
|
|
||||||
this.image = mexui.native.loadImage(filePath);
|
this.image = mexui.native.loadImage(filePath);
|
||||||
});
|
});
|
||||||
@@ -8,6 +8,25 @@ mexui.util.createControlConstructor('Image', false, function(window, x, y, w, h,
|
|||||||
// default styles
|
// default styles
|
||||||
mexui.util.linkBaseControlStyles('Image', {});
|
mexui.util.linkBaseControlStyles('Image', {});
|
||||||
|
|
||||||
|
// input
|
||||||
|
mexui.Control.Image.prototype.onMouseDown = function(e)
|
||||||
|
{
|
||||||
|
if(e.button == 0 && this.isCursorOverControl())
|
||||||
|
{
|
||||||
|
e.used = true;
|
||||||
|
this.checkToCallCallback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mexui.Control.Image.prototype.onKeyDown = function(e, key, mods)
|
||||||
|
{
|
||||||
|
if(this.isFocused() && (key == SDLK_RETURN || key == SDLK_RETURN2 || key == SDLK_KP_ENTER || key == SDLK_SPACE))
|
||||||
|
{
|
||||||
|
e.used = true;
|
||||||
|
this.checkToCallCallback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// render
|
// render
|
||||||
mexui.Control.Image.prototype.render = function()
|
mexui.Control.Image.prototype.render = function()
|
||||||
{
|
{
|
||||||
@@ -18,13 +37,3 @@ mexui.Control.Image.prototype.render = function()
|
|||||||
if(this.isFocused())
|
if(this.isFocused())
|
||||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(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'));
|
||||||
};
|
};
|
||||||
|
|
||||||
// input
|
|
||||||
mexui.Control.Image.prototype.onMouseDown = function(e)
|
|
||||||
{
|
|
||||||
if(e.button == 0 && this.isCursorOverControl())
|
|
||||||
{
|
|
||||||
e.used = true;
|
|
||||||
this.checkToCallCallback();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
1
third-party/mexui/Core/Control/List.js
vendored
1
third-party/mexui/Core/Control/List.js
vendored
@@ -59,3 +59,4 @@ mexui.Control.List.prototype.row = function(text)
|
|||||||
this.axis.y.addEntry(entry);
|
this.axis.y.addEntry(entry);
|
||||||
return entry;
|
return entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Control/Slider.js
vendored
1
third-party/mexui/Core/Control/Slider.js
vendored
@@ -113,3 +113,4 @@ mexui.Control.Slider.prototype.clampProgress = function()
|
|||||||
else if(this.progress > 1.0)
|
else if(this.progress > 1.0)
|
||||||
this.progress = 1.0;
|
this.progress = 1.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Control/Tree.js
vendored
1
third-party/mexui/Core/Control/Tree.js
vendored
@@ -153,3 +153,4 @@ mexui.Control.Tree.prototype.row = function(text)
|
|||||||
this.axis.y.addEntry(entry);
|
this.axis.y.addEntry(entry);
|
||||||
return entry;
|
return entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Entity/ControlAxis.js
vendored
1
third-party/mexui/Core/Entity/ControlAxis.js
vendored
@@ -197,3 +197,4 @@ mexui.Entity.ControlAxis.prototype.getDisplayedEntryCount = function()
|
|||||||
var displayedEntryCount = Math.floor(displayedEntriesLength / this.control.entrySize[this.axisIndex]);
|
var displayedEntryCount = Math.floor(displayedEntriesLength / this.control.entrySize[this.axisIndex]);
|
||||||
return this.entries.length < displayedEntryCount ? this.entries.length : displayedEntryCount;
|
return this.entries.length < displayedEntryCount ? this.entries.length : displayedEntryCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -95,3 +95,4 @@ mexui.Entity.ControlWithEntries.prototype.removeAllEntries = function()
|
|||||||
this.axis.x.removeAllEntries();
|
this.axis.x.removeAllEntries();
|
||||||
this.axis.y.removeAllEntries();
|
this.axis.y.removeAllEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -207,3 +207,4 @@ mexui.Entity.StyleableEntity.prototype.getTransitionTimeStyle = function(control
|
|||||||
else
|
else
|
||||||
return mexui.Entity.Transition.defaultTransitionTime;
|
return mexui.Entity.Transition.defaultTransitionTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Entity/Transition.js
vendored
1
third-party/mexui/Core/Entity/Transition.js
vendored
@@ -181,3 +181,4 @@ mexui.Entity.Transition.prototype.clearDelayTimer = function()
|
|||||||
clearTimeout(this.delayTimer);
|
clearTimeout(this.delayTimer);
|
||||||
this.delayTimer = null;
|
this.delayTimer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Entry/GridRow.js
vendored
1
third-party/mexui/Core/Entry/GridRow.js
vendored
@@ -10,3 +10,4 @@ mexui.util.extend(mexui.Entry.GridRow, mexui.Component.Entry);
|
|||||||
|
|
||||||
// default styles
|
// default styles
|
||||||
mexui.Entry.GridRow.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {});
|
mexui.Entry.GridRow.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {});
|
||||||
|
|
||||||
|
|||||||
17
third-party/mexui/Core/Native.js
vendored
17
third-party/mexui/Core/Native.js
vendored
@@ -6,7 +6,7 @@ mexui.native.loadImage = function(imageFilePath, imageName)
|
|||||||
var file = openFile(imageFilePath);
|
var file = openFile(imageFilePath);
|
||||||
if(!file)
|
if(!file)
|
||||||
{
|
{
|
||||||
logToConsole(LOG_DEBUG|LOG_ERROR, 'ERROR [IMAGE LOAD] - Opening File: '+imageFilePath);
|
console.log('ERROR [IMAGE LOAD] - Opening File: '+imageFilePath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,19 +14,19 @@ mexui.native.loadImage = function(imageFilePath, imageName)
|
|||||||
var parts = imageFilePath.split('.');
|
var parts = imageFilePath.split('.');
|
||||||
var ext = parts[parts.length - 1].toLowerCase();
|
var ext = parts[parts.length - 1].toLowerCase();
|
||||||
if(ext == 'png')
|
if(ext == 'png')
|
||||||
image = drawing.loadPNG(file);
|
image = graphics.loadPNG(file);
|
||||||
else if(ext == 'bmp')
|
else if(ext == 'bmp')
|
||||||
image = drawing.loadBMP(file);
|
image = graphics.loadBMP(file);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logToConsole(LOG_DEBUG|LOG_ERROR, 'ERROR [IMAGE LOAD] - Unsupported image file path extension. Currently only supports PNG or BMP.');
|
console.log('ERROR [IMAGE LOAD] - Unsupported image file path extension. Currently only supports PNG or BMP.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!image)
|
if(!image)
|
||||||
{
|
{
|
||||||
file.close();
|
file.close();
|
||||||
logToConsole(LOG_DEBUG|LOG_ERROR, 'ERROR [IMAGE LOAD] - Reading File: '+imageFilePath);
|
console.log('ERROR [IMAGE LOAD] - Reading File: '+imageFilePath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ mexui.native.drawRectangleBackground = function(position, size, styles)
|
|||||||
if(backgroundColour == null || backgroundColour == 'none')
|
if(backgroundColour == null || backgroundColour == 'none')
|
||||||
return;
|
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)
|
mexui.native.drawRectangleBorder = function(position, size, styles)
|
||||||
@@ -133,7 +133,7 @@ mexui.native.drawAALine = function(point1, point2, styles)
|
|||||||
if(lineColour == null || lineColour == 'none')
|
if(lineColour == null || lineColour == 'none')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawing.drawRectangle(null, point1, new Vec2((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)
|
mexui.native.drawText = function(position, size, text, styles)
|
||||||
@@ -149,5 +149,6 @@ mexui.native.drawText = function(position, size, text, styles)
|
|||||||
|
|
||||||
mexui.native.drawImage = function(position, size, image, styles)
|
mexui.native.drawImage = function(position, size, image, styles)
|
||||||
{
|
{
|
||||||
drawing.drawRectangle(image, position, size);
|
graphics.drawRectangle(image, position, size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
10
third-party/mexui/Core/Utility.js
vendored
10
third-party/mexui/Core/Utility.js
vendored
@@ -236,15 +236,15 @@ mexui.util.getCenterPosition = function(largerSize, smallerSize)
|
|||||||
|
|
||||||
mexui.util.getWindowSize = function()
|
mexui.util.getWindowSize = function()
|
||||||
{
|
{
|
||||||
return new Vec2(game.width, game.height);
|
return new Vec2(gta.width, gta.height);
|
||||||
};
|
};
|
||||||
|
|
||||||
mexui.util.isRectangleInsideRectangle = function(pos1, size1, pos2, size2)
|
mexui.util.isRectangleInsideRectangle = function(pos1, size1, pos2, size2)
|
||||||
{
|
{
|
||||||
return !(pos2.x > (pos1.x + size1.x) ||
|
return !(pos2.x > (pos1.x + size1.x) ||
|
||||||
(pos2.x + size2.x) < pos1.x ||
|
(pos2.x + size2.x) < pos1.x ||
|
||||||
pos2.y > (pos1.y + size1.y) ||
|
pos2.y > (pos1.y + size1.y) ||
|
||||||
(pos2.y + size2.y) < pos1.y);
|
(pos2.y + size2.y) < pos1.y);
|
||||||
};
|
};
|
||||||
|
|
||||||
mexui.util.mergeStyles = function(styles, pseudoPartNames)
|
mexui.util.mergeStyles = function(styles, pseudoPartNames)
|
||||||
@@ -476,7 +476,7 @@ mexui.util.fromColour = function(colour)
|
|||||||
|
|
||||||
mexui.util.time = function()
|
mexui.util.time = function()
|
||||||
{
|
{
|
||||||
return sdl.tickCount;
|
return gta.tickCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
mexui.util.isIntChar = function(character)
|
mexui.util.isIntChar = function(character)
|
||||||
|
|||||||
30
third-party/mexui/mexui.js
vendored
30
third-party/mexui/mexui.js
vendored
@@ -17,7 +17,7 @@ mexui.hoveredComponent = null;
|
|||||||
// initialization
|
// initialization
|
||||||
mexui.init = function()
|
mexui.init = function()
|
||||||
{
|
{
|
||||||
mexui.native.loadImage('third-party/mexui/Images/down-arrow.png', 'downArrow');
|
mexui.native.loadImage('mexui/Images/down-arrow.png', 'downArrow');
|
||||||
mexui.bindEvents();
|
mexui.bindEvents();
|
||||||
mexui.startTimers();
|
mexui.startTimers();
|
||||||
};
|
};
|
||||||
@@ -76,10 +76,13 @@ mexui.bindEvents = function()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addEventHandler('onDrawnHUD', function(event)
|
|
||||||
{
|
{
|
||||||
mexui.render();
|
var eventName = gta.game == GAME_GTA_SA ? 'onDrawnHUD' : 'onBeforeDrawHUD';
|
||||||
});
|
addEventHandler(eventName, function(event)
|
||||||
|
{
|
||||||
|
mexui.render();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mexui.unbindEvents = function()
|
mexui.unbindEvents = function()
|
||||||
@@ -90,7 +93,7 @@ mexui.unbindEvents = function()
|
|||||||
removeEventHandler('onMouseWheel');
|
removeEventHandler('onMouseWheel');
|
||||||
removeEventHandler('onKeyDown');
|
removeEventHandler('onKeyDown');
|
||||||
removeEventHandler('onCharacter');
|
removeEventHandler('onCharacter');
|
||||||
removeEventHandler('onDrawnHUD');
|
removeEventHandler('onBeforeDrawHUD');
|
||||||
};
|
};
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
@@ -287,13 +290,12 @@ mexui.isAnyWindowShown = function()
|
|||||||
mexui.setInput = function(showInput)
|
mexui.setInput = function(showInput)
|
||||||
{
|
{
|
||||||
gui.showCursor(showInput, !showInput);
|
gui.showCursor(showInput, !showInput);
|
||||||
//if(game.game != VRR_GAME_GTA_IV) {
|
if(localClient.player && gta.game != GAME_GTA_IV)
|
||||||
// if(localPlayer)
|
{
|
||||||
// {
|
if(showInput)
|
||||||
// if(showInput)
|
gta.setCameraLookAtEntity(new Vec3(gta.cameraMatrix.m41, gta.cameraMatrix.m42, gta.cameraMatrix.m43), localPlayer, false);
|
||||||
// game.setCameraLookAt(new Vec3(game.cameraMatrix.m41, game.cameraMatrix.m42, game.cameraMatrix.m43), localPlayer.position, false);
|
else
|
||||||
// else
|
gta.restoreCamera(false);
|
||||||
// game.restoreCamera(false);
|
}
|
||||||
// }
|
|
||||||
//}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user