Thank you!
ome6a1717
Creator of
Recent community posts
That’s the intended behavior at the moment. The offset isn’t only a draw offset, it also offsets any hovering coordinates.
What I would maybe do in your case is put the label in a horizontal container, and handle the hovering callback on the container instead of the label (so the container should still have the same hit box)
I originally intended them to scale, but can't remember why I left it out. I'll take a look, but in the meantime what I would do is place the image and set it's visibility to false. Then you can just manually draw your
img = auto_image(<data>); img.set_visible(false); // NOTE: you might need to add space using container.add_space(sprite_get_height(sprite) * scale)) to push the other elements // DRAW EVENT draw_sprite_ext(sprite, frame, img.get_bbox_left(), img.get_bbox_top(), etc.)
I think my hesitating factor was whether or not scaled images should push the adjacent content...maybe I'll add this to the next update.
I'm not quite sure what you mean about procedurally generated content, but if you're asking "can you add an infinite number of elements and scroll all of them", yes. The scrolling is based on the content you place inside the scroller.
Unfortunately, right now it does not support scribble - I thought about possibly making a "create_auto_surface" that would allow you to put whatever you'd like in a callback (like scribble), but I haven't gotten that far yet...
I've found scope to be very difficult to figure out in GML when using script_execute, to be honest. For instance, what you did will work fine for windows/macos export, but if you export to HTML5, it will sometimes throw an error that it is unable to find your element.
It's generally just best practice to pass in all objects you use or reference for safety:
my_button = auto_button(/* data */);
my_button.set_click_func(function(_obj, _btn) {
_btn.color = c_white; // eg.
_obj.variable = 2; // eg.
}, [self, my_button]);CHANGES TO BE AWARE OF
- The grouping of the script/notes/examples are now in Tools > AutoUi instead of their respective Scripts/Notes/Etc. folders
NEW ELEMENTS
- New ELEMENT: (auto_nine_slice) - a simple nine-slice sprite that flexes it's w/h to the parent container
UPDATES
- (auto_lifebar) - set_value() now has an optional added parameter, _instant (instantly sets the value instead of lerping)
- (auto_label) - now has an optional index frame for nine_slice_background (set using set_nine_slice_frame())
- .set_visible() sets hovering to false on call (if you were hovering and called set visible, it would keep true indefinitely)
BUG FIXES
- Minor bug fixes
- Stack's set_visible() now correctly affects all children
- Auto-complete will now provide all of the variables and methods for each element
Really glad you're finding it useful, and thanks so much for the kind words!
I thought about doing a video regarding this since I had to figure it out in my recent game, but for now here is the method I used:
1. Create a 'select' index variable, radiogroup, and function in your object that creates the "structure" of your selection (in the create event):
radiogroup = auto_radiogroup();
select = 0; // the index currently selected
options = []; // we'll add this later
menu_option = function(_name) {
var _btn = auto_button_checkable_center(120, 40, _name, font, bgsprite, false, radiogroup);
return _btn;
};
2. Add all of your options
options[0] = menu_option("Start");
options[1] = menu_option("Load");
options[2] = menu_option("Quit");
// add to your main container3. Then in the step event:
if control_is_pressed("down") {
select = (select+1) mod array_length(options); // set to next index
options[select].set_checked(true, true); // checks this button and unchecks the rest of the radiogroup
}
if control_is_pressed("up") {
select = (select+array_length(options)-1) mod array_length(options);
options[select].set_checked(true, true); // checks this button and unchecks the rest of the radiogroup
}
if control_is_pressed("select") {
switch(select) {
case 0: startgame(); break;
case 1: loadgame(); break;
case 2: game_end(); break;
}
}Obviously this is a relatively rudimentary version of this, but again - I might do a video going into further detail.
Now, if you're like me and need to display more than just a button (eg. you want to have the "container" selectable), for now, you can kind of hack this by using a button as the background (with text set to ""), and place that and all of your elements in a stack.
Hopefully that should point you in the right direction!
Thank you so much!
While it doesn't explicitly support gamepad, there are many ways you can do it:
--- CREATE EVENT ---
index = 0; // your current selected index
c = auto_container_v(80, 8); // width/spacing
radiogroup = auto_radiogroup();
/// @desc Returns a struct of a new button element, index, and select function
new_button = function(_text, _index, _select_func) {
// Create the button
var _btn = auto_button_checkable_center(80, 32, _text, FONTS.px_6x6, s_tt_btn_purple, _index == 0, radiogroup);
// Set the hovering function, passing in this object and the index
_btn.set_hovering_func(function(_obj, _index) {
// Set this button to be "checked", and uncheck all other buttons in the radio group
set_checked(true, true);
_obj.index = _index; // set the obj's index correctly
}, [self, _index]);
// Assign the click function
_btn.set_click_func(function(_select_func) {
_select_func();
}, [_select_func]);
// Returning a struct of the button, index and select function
return {
button: _btn,
index: _index,
select: _select_func
}
}
// Here is our struct data where we create our buttons
button_data = [
new_button("New Game", 0, function() { show_debug_message("START NEW GAME"); }),
new_button("Load Game", 1, function() { show_debug_message("LOAD GAME"); }),
new_button("Quit Game", 2, function() { game_end(); })
]
// And don't forget to add the button to the main container
for (var i = 0; i < array_length(button_data); i++) { c.add(button_data[i].button); }
--- STEP EVENT ---
c.step(5, 5);
// EZ check if you press up or down (uses AutoInput; replace with gamepad_button_check etc.)
var _ydir = control_is_pressed("menu_down", 0) - control_is_pressed("menu_up", 0);
// If a button was pressed...
if _ydir != 0 {
// Set the index
index = (index + array_length(button_data) + _ydir) mod array_length(button_data);
// And make sure to set checked to true
button_data[index].button.set_checked(true, true);
}
// If select, run function
if control_is_pressed("menu_select", 0) { button_data[index].select(); }
And then run c.draw() in your draw event! Now it handles BOTH mouse and gamepad.
Hopefully that helps - it's not quite as cut and dry, but because some people have their own input systems (eg. AutoTools' AutoInput!), I didn't want to put too much of that in AutoUi.
I'll probably add this to an example in the package, though - thanks for the suggestion!




























