GML Looking for a dialog box ...

luxo-JR

Member
Hello, I'm looking to create a dialog box to display a message and a button to close this box. I did some research with no solutions. I came across this code (attached code). I manage to use it, but as an advisor in the comment of this code, it must be implemented in a draw event; but for me I need the mouse_clic event and thus display the box with its message, it is a warning to inform the user. An idea.

GML:
    /// draw_get_button(x,y,str,width,height,color,hover,bgcolor)
    //
    //  Draws a simple labeled button on the screen and returns true
    //  if it has been clicked using the left mouse button. This should
    //  be called during a Draw Event is intended for testing purposes.
    //  Text alignment will be set to horizontal and vertical centering.
    //
    //      x,y         position to draw center of button, real
    //      str         text to display inside button, string
    //      width       width of button, real
    //      height      height of button, real
    //      color       color of text, real
    //      hover       color of text when mouse is over button, real
    //      bgcolor     color of background when mouse is over button, real
    //
    /// GMLscripts.com/license
    {
        var xx,yy,str,w,h,col1,col2,col3,prev_color,prev_alpha,bl,br,bt,bb,in;
        xx = argument0;
        yy = argument1;
        str = argument2;
        w = argument3 / 2;
        h = argument4 / 2;
        col1 = argument5;
        col2 = argument6;
        col3 = argument7;
        prev_color = draw_get_color();
        prev_alpha = draw_get_alpha();
        bl = xx - w;
        br = xx + w;
        bt = yy - h;
        bb = yy + h;
        in = (mouse_x>bl && mouse_x<br && mouse_y>bt && mouse_y<bb);
        if (in) {
            draw_set_color(col3);
            draw_set_alpha(0.2);
            draw_rectangle(bl,bt,br,bb,false);
            draw_set_color(col2);
            draw_set_alpha(1);
        }else{
            draw_set_color(col1);
            draw_set_alpha(0.3);
        }
        draw_rectangle(bl,bt,br,bb,true);
        draw_set_halign(fa_center);
        draw_set_valign(fa_middle);
        draw_text(xx,yy,str);
        draw_set_color(prev_color);
        draw_set_alpha(prev_alpha);
        return (in && mouse_check_button_pressed(mb_left));
    }
 

TailBit

Member
In the start I usually just had a textbox object that I created when I interacted with it, and from the object I interacted with I told it what lines to show and such:
GML:
ins = instance_create_layer( ...textbox_obj...)
ins.text = "you found sword"
And then the textbox object draws the text variable in its draw event.

Even if you use a UI system, then you have something else draw it
 

Nidoking

Member
I need the mouse_clic event and thus display the box with its message
You don't seem to understand how events work. Drawing happens in Draw events. You don't draw in a Mouse event. Instead, in the Mouse event, you set something that tells the Draw event whether or not to draw at each step, or you create an instance that will draw during its Draw event and then destroy it when you're done with it.
 

luxo-JR

Member
Thank you for your answers, I think I misspoke. I'm starting to understand how events work. The more I advance in my project, the more I discover new things and I look for solutions to these problems. For this dialog, could you give me some code. Thank you. On a related note, I am looking for a file picker; display a list of files with arrows for up and down as well as a cursor to scroll the list. I can already retrieve the list of files. Thank you.
 

Attachments

TailBit

Member
A dialog in its simplest form would just be to draw a sprite for the box and the text variable with the string we gave to the textbox object, but draw_sprite followed by draw_text is maybe not what you are looking for? You could feed it an array of strings, even images for character faces that it should go through on keypress. You could make a engine that goes through the text and displays it with effects .. but we don't know what you want for it, also .. what did you try?

Making a scrollbar and using it to manipulate how you show a list is a good challenge that there are plenty of resources on .. well, the scrollbar at least xD but when you understand it then the other part gets easier.

Since you need both of those .. do you perhaps need a complete GUI system?
 

luxo-JR

Member
Thank you for your answer, it clears up a bit. But I should have started with a description of the context. I am in the process of developing a level editor for my game that I will develop later. In my level editor there are different scenarios. For example, there is the choice of a color to do first; there must be a color chosen to be able to choose a particular object (sprite). In this case, there is the need for a dialog box to tell the user to choose a color before choosing the object. I think this dialog should have some informational text and a button to 'close' this box. In this editor, I have other identical situations. Thanks again.
 

luxo-JR

Member
Hello, I am coming back to you because I am still looking for the solution for my dialog box problem. I did some research on the web, found some videos and various tutorials. I did some tests, with no noticeable results. It is true that I am new to Game Maker Studio. I work on two projects simultaneously, one of which requires a lot of work. Can someone help me with these 'goddamn dialogs'. A big thank-you. I am attaching an image of the dialog template I want. I want to set up an alert box and not a dialog box, or a pop-up that displays a message with a button (ok) to close this pop-up.
 

Attachments

Last edited:

TailBit

Member
You could just break down the dialog template into rectangle drawings and 2 draw string operations, with a mouse check in a specific area:

So the draw event of your textbox object would use these functions:

draw_rectangle_colour for the white box
draw_string for the text

draw_roundrect_colour for the button bg color
draw_roundrect for the button outline
another draw_string for the button text

then do a if mouse_check_button_pressed followed by a
if point_in_rectangle for the button press check

instance_destroy to delete it if the checks above did pass

you can use draw_set_halign and draw_set_valign for centering the text, but I recommend setting them back to the defaults after use.

the first draw_string could draw a variable instead, that you set in the create event, that way you can change the display text upon creating the textbox instance by using the way in my first post here.

Have a box object .. upon creating the box object, it creates a instance of a button object, and tell it who created it .. then delete it and its creator on the button press .. also the same draw_string as mentioned on the line above, just with a draw_self before it
 

luxo-JR

Member
Thank you for your answer because I am really stuck and I had given the wrong direction in my first post on the forum, sorry. To go further, in my interface, I have a set of buttons and I must ensure consistency of operation (such and such thing must be done before another ...). In your information, I don't see when I should create an instance of my object (alertbox). In operation, I click on a button (interface), I check some variables and I trigger the alertbox according to this check. I create the instance in my verification process? For the rest of your post, I think I get it. I'm going to try. Thank you again, I would allow myself to come back if I have any problems ...
 

luxo-JR

Member
Hello, I am making progress but I still have some concerns. I created an object (oDialog); in its 'create' event I initialize the 'message_box' string to an empty string (message_box = ""); in the 'draw' event I calculate the dimensions of the box and I display it as well as the text. For now, I have a display error and I can't find why, the box is displayed vertically instead of being horizontal, she does not stay on display . On the other hand, I have a problem with the creation of the instance of my 'oDialog' object. For the test, I have an object on the room and I have assigned a 'Left mouse button pressed' event. When I click, I create the instance of oDialog and I assign my variable 'message_box' the message to display. However, how should I assign the x and y variables of my 'var MsgBox = instance_create_layer (x, y, "Instances_1", oDialog);' I do not understand.

Code 'Event Draw' of oDialog
GML:
//show_message("Message : " + message_box + " Message length : " + string(string_length(message_box)));
//show_message(">> stringwidth : " + string(string_width(message_box)));
box_width = 5 + string_width(message_box) + 5;
box_height = 5 + string_height(message_box) + 5;
box_x = (room_width / 2) - (box_width / 2);
box_y = (room_height / 2) - (box_height / 2);
//show_message("> box_width : " + string(box_width) + " box_height : " + string(box_height));
//show_message("> box_x : " + string(box_x) + " box_y : " + string(box_y));
//show_message("> Roomwidth : " + string(room_width) + " Roomheight : " + string(room_height));
draw_roundrect(box_x, box_y, box_width, box_height, 0);
draw_set_color(c_black);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(box_x + (box_width / 2), box_y + (box_height / 2), message_box);
Code 'Event Create' of oDialog
GML:
var message_box = "";
Code Event Left button engaged 'Test object'
GML:
var MsgBox = instance_create_layer(x, y, "Instances_1", oDialog);
MsgBox.message_box = "Message welcome !";
 
Last edited:
However, how should I assign the x and y variables of my 'var MsgBox = instance_create_layer (x, y, "Instances_1", oDialog);' I do not understand.

GML:
var MsgBox = instance_create_layer(x, y, "Instances_1", oDialog);
MsgBox.message_box = "Message welcome !";
The same way (dot notation) you did the message, or you can also use
GML:
with(MsgBox){
    //stuff
}
Also, for a dialog box, draw_text_ext() is much friendlier than draw_text(), as it has built-in message width and spacing, it's pretty cool.
 

TailBit

Member
When using:
GML:
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
it will stay that way until it is changed again, so your:
GML:
draw_roundrect(box_x, box_y, box_width, box_height, 0);
will be affected by it the next step, so after using it you need to turn it back to the default:
GML:
draw_set_halign(fa_left);
draw_set_valign(fa_top);
If you don't want other things to get affected..

You give it the x and y upon creation, in the instace_create_layer function, but those coordinates don't really matter since you want to center it, you could pretty much write x and y instead of box_x and box_y
 

luxo-JR

Member
Hello, I'm making progress (see screenshot), but I'm having trouble with object instances. in my example I have a 'test' object on the room. When I click on this object, I create an instance of my 'dialogbox' object and initialize the dialog message and button label (ok).
GML:
MsgBox = instance_create_layer(1, 1, "Instances_1", oDialog);
MsgBox.message_box = "Message de bienvenue sur Gamme Maker Studio!";
MsgBox.message_button = "OK";
screen-shot.png
Two questions; do I have to create a new instance of another object (for the button) and how to destroy the instance of the dialog box and the button; how do i go about creating a hover effect on the button, redraw the button with another shade when the mouse is on it. Thank you in advance.
 

TailBit

Member
You have pretty much answered yourself ^^

Creating a new instance is one way to do it.

But the draw_get_button code you started with pretty much does this without a new instance, it instead:
- it checks if the mouse is within a rectangle
- selects color based on that
- draws the rectangles for the button
- returns if you are over the button or not
So your code would look like:

draw event
GML:
if draw_get_button( ... ) {
    instance_destroy();
}
 

luxo-JR

Member
Thank you for your reply. By making a synthesis, I came to this. I need to create an instance of an 'ODialog' object which draws the dialog box. Should I create another instance of another object, in this case for the 'OK' button? And how do you bind the two instances for their 'destroy'? I think I understood the 'mouse in a rectangle' approach for the 'OK' button. I am sorry to always come back to this subject but I find it difficult to understand the notion of instance and its management. Thanks again. Jean-Francois.
 

luxo-JR

Member
Hello. I finally succeeded. But I have a question again. Variables created in an event (example 'Draw Event') are not visible in another event provided they are put in 'global'? I am attaching the code to you, it is in development therefore imperfect. There is a problem, I want to change the color of the 'OK' button when the mouse is inside the button and the left mouse button is pressed. In closing, I wanted to say a big thank you for your help. I was going to forget, in my program I work with two layers, one for the menu and a second for the work area. The operation is as follows, I select an object in the menu, I hide the menu and I find myself on the work area. How to get the right sprite via a varaile which contains the 'name' of the chosen object and a sprite_index behind for the assignment? Thank you.
GML:
//show_message("Message : " + message_box + " Message length : " + string(string_length(message_box)));//
//show_message(">> stringwidth : " + string(string_width(message_box)));

box_width = 5 + string_width(message_box) + 5;
button_height = 5 + string_height(message_button) + 5;
box_height = 5 + string_height(message_box) + 10 + button_height;
box_x = ceil((room_width / 2) - (box_width / 2));
box_y = ceil((room_height / 2) - (box_height / 2));

button_width = 10 + string_width(message_button) + 10;
//button_height = 5 + string_height(message_button) + 5
button_x = ceil(room_width / 2) - ceil(button_width / 2);
button_y = box_y + button_height;



draw_set_colour(c_white);
draw_roundrect(box_x, box_y, box_x + box_width, box_y + box_height, 0);
draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, c_white, c_black, 1);
draw_set_color(c_black);
draw_set_halign(fa_center);
draw_set_valign(fa_bottom);
draw_text(box_x + (box_width / 2), box_y + (box_height / 2), message_box);
draw_set_valign(fa_middle);
draw_text(button_x + (button_width / 2), button_y + (button_height / 2), message_button);
draw_set_halign(fa_left);
draw_set_valign(fa_top);

mouse_press_left =  mouse_check_button_pressed(mb_left);
if (mouse_press_left)
{
   point_in_rect = point_in_rectangle(mouse_x, mouse_y, button_x, button_y, button_x + button_width, button_y + button_height)
   if (point_in_rect)
   {
      //show_message("mouse : " + string(mouse_press_left) + " point : " + string(point_in_rect));
      //draw_set_colour(c_red);
      draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, c_ltgrey, c_black, 1);
      //draw_set_colour(c_white);
      instance_destroy(oDialog);
   }
}
 

TailBit

Member
To answer the previous question, if you make a new button instance, then tell it who created it:

ODialog create event
GML:
var ins = instance_create_layer( ... );
ins.owner= id;
On button click:
GML:
instance_destroy(owner);
instance_destroy();
delete owner and itself

Variables created in an event (example 'Draw Event') are not visible in another event provided they are put in 'global'?
Yes, but you will get an error if you try to use it in events that are before the draw event, since that is where we create them, but usually when we only need variables in one event before we want to discard them, then we use a local variable that we declare with "var", it won't exist anymore when the event ends.. if you wanted to read them in other events you would either have to use some form of variable_exist so you can read them on the 2nd step, or declare them in the create event first.

I want to change the color of the 'OK' button when the mouse is inside the button and the left mouse button is pressed.
For that I separated your code so that the code for the button is at the bottom:

GML:
//show_message("Message : " + message_box + " Message length : " + string(string_length(message_box)));//
//show_message(">> stringwidth : " + string(string_width(message_box)));

box_width = 5 + string_width(message_box) + 5;
button_height = 5 + string_height(message_button) + 5;
box_height = 5 + string_height(message_box) + 10 + button_height;
box_x = ceil((room_width / 2) - (box_width / 2));
box_y = ceil((room_height / 2) - (box_height / 2));

button_width = 10 + string_width(message_button) + 10;
//button_height = 5 + string_height(message_button) + 5
button_x = ceil(room_width / 2) - ceil(button_width / 2);
button_y = box_y + button_height;



draw_set_colour(c_white);
draw_roundrect(box_x, box_y, box_x + box_width, box_y + box_height, 0);
draw_set_color(c_black);
draw_set_halign(fa_center);
draw_set_valign(fa_bottom);
draw_text(box_x + (box_width / 2), box_y + (box_height / 2), message_box);
draw_set_halign(fa_left);
draw_set_valign(fa_top);

// button part

draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, c_white, c_black, 1);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(button_x + (button_width / 2), button_y + (button_height / 2), message_button);
draw_set_halign(fa_left);
draw_set_valign(fa_top);

mouse_press_left =  mouse_check_button_pressed(mb_left);
if (mouse_press_left)
{
   point_in_rect = point_in_rectangle(mouse_x, mouse_y, button_x, button_y, button_x + button_width, button_y + button_height)
   if (point_in_rect)
   {
      //show_message("mouse : " + string(mouse_press_left) + " point : " + string(point_in_rect));
      //draw_set_colour(c_red);
      draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, c_ltgrey, c_black, 1);
      //draw_set_colour(c_white);
      instance_destroy(oDialog);
   }
}

the easiest way would be to have a variable that holds the default color, and then detect if above button or mouse down, and change it thereafter, then use it for drawing:

So the button part could be changed to:
Code:
var col = c_white; // the default button color

var mouse_held =  mouse_check_button(mb_left);
var point_in_rect = point_in_rectangle(mouse_x, mouse_y, button_x, button_y, button_x + button_width, button_y + button_height);

if(point_in_rect){
    if(mouse_held) col = c_dkgrey else col = c_ltgrey; // light gray if over, dark gray if held down
    
    if mouse_check_button_released(mb_left) instance_destroy();
}

// then we can use col here:
draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, col , c_black, 1);

draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(button_x + (button_width / 2), button_y + (button_height / 2), message_button);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
since you want to show new color if button is down, then I made the destroy happen when you release the press ..

I would have put this in a script and let it return if true if the button should trigger

(This is for GM 2.3+, not sure what version you are on)
Code:
function draw_a_button(x,y,w,h,str){
    var col = c_white;

    var mouse_held =  mouse_check_button(mb_left);
    var point_in_rect = point_in_rectangle(mouse_x, mouse_y, x, y, x + w, y + w);

    if(point_in_rect){
        if(mouse_held) col = c_dkgrey else col = c_ltgrey;
    }

    // then we can use col here:
    draw_roundrect_colour(x, y, x + w, y + h, col , c_black, 1);

    draw_set_halign(fa_center);
    draw_set_valign(fa_middle);
    draw_text(x + (w / 2), y + (h / 2), str);
    draw_set_halign(fa_left);
    draw_set_valign(fa_top);
    
    // the biggest change is that we return if it is in the rectangle and released
    return point_in_rect && mouse_check_button_released(mb_left);
}
GML:
// script name: draw_a_button
// draw_a_button(x,y,width,height,string)
// returns true if mouse released on it

var xx = argument0,
    yy = argument1,
    w  = argument2,
    h  = argument3,
    str= argument4,
    col = c_white;

var mouse_held =  mouse_check_button(mb_left);
var point_in_rect = point_in_rectangle(mouse_x, mouse_y, xx, yy, xx + w, y + w);

if(point_in_rect){
    if(mouse_held) col = c_dkgrey else col = c_ltgrey;
}

// then we can use col here:
draw_roundrect_colour(xx, yy, xx + w, yy + h, col , c_black, 1);

draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_text(xx + (w / 2), yy + (h / 2), str);
draw_set_halign(fa_left);
draw_set_valign(fa_top);

// the biggest change is that we return if it is in the rectange and released
return point_in_rect && mouse_check_button_released(mb_left);

Then the button part of your draw event could be:
Code:
if draw_a_button(button_x, button_y, button_width, button_height, message_button) {
    instance_destroy();
}
You don't need anything in instance_destroy() when destroying itself, if you use the object then it will destroy all of them if you had multiple ODialog on screen.

The operation is as follows, I select an object in the menu, I hide the menu and I find myself on the work area. How to get the right sprite via a varaile which contains the 'name' of the chosen object and a sprite_index behind for the assignment?
When selecting from the menu, store the selection in a control object or global variable that you can use elsewhere
 

luxo-JR

Member
Hello. Thank you for your reply. I think I understood your guidelines, I will test it all. However, I need more information regarding the creation of an instance.
GML:
var ins = instance_create_layer( ... );
ins.owner= id;
The creation of the instance is ok. On the other hand, it is the following line. Why go through 'owner' and where does the 'id' variable come from. I found for 'id', it is the unique identifier of the created instance.
GML:
instance_destroy(owner);
instance_destroy();
Why 2 destroy ?
 
Last edited:

Nidoking

Member
Why go through 'owner'
This question doesn't make sense to me. owner is a variable that you are creating to hold a value. Variables hold values so that you can use them later. You're not "going through" anything.

where does the 'id' variable come from.
I found for 'id', it is the unique identifier of the created instance.
No, it is the unique identifier of the instance that it is the unique identifier of. The created instance is called "ins" here. The id of ins would be ins.id. id is the id of the "self" instance, the instance in whose scope this code runs.

Why 2 destroy ?
Because there are two instances that need to be destroyed. One is stored in the "owner" variable as established above, and the other is "self". Make sure you understand what variables are as well as what instances are, and reread this thread so you can understand what you've been told.
 

luxo-JR

Member
Hello, thank you for your answer. I think I understood the treatment of 'instances'. I will test all of this. As I continue my development, I have found that I will need a dialog box with two buttons, a 'yes' button and a 'no' button. With what I have in hand and all the help I got from the forum, I will be successful. I would come back to the forum if needed. Thanks again. Jean-Francois
 

luxo-JR

Member
Hello, I'm back with a question, sorry ... I applied the instructions and advice correctly, but I may have a color problem with my code. The functional side is I think ok. I have a dialog box with an 'OK' button to close the box. I want to change the button colors (the background color and the text color) when the mouse is on the button and the same way when I click on the button, of course with different colors (background and text). It may be nothing but I can't see. Thank you.

GML:
var box_width = 5 + string_width(message_box) + 5;
var button_height = 5 + string_height(message_button) + 5;
var box_height = 5 + string_height(message_box) + 10 + button_height;
var box_x = ceil((room_width / 2) - (box_width / 2));
var box_y = ceil((room_height / 2) - (box_height / 2));

var button_width = 10 + string_width(message_button) + 10;
//button_height = 5 + string_height(message_button) + 5
var button_x = ceil(room_width / 2) - ceil(button_width / 2);
var button_y = box_y + button_height;

draw_set_colour(c_white);
draw_roundrect(box_x, box_y, box_x + box_width, box_y + box_height, 0);
draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, c_white, c_black, 1);
draw_set_color(c_black);
draw_set_halign(fa_center);
draw_set_valign(fa_bottom);
draw_text(box_x + (box_width / 2), box_y + (box_height / 2), message_box);

var color = c_white; // the default button color
var color_txt = c_black;
var mouse_held =  mouse_check_button(mb_left);
var point_in_rect = point_in_rectangle(mouse_x, mouse_y, button_x, button_y, button_x + button_width, button_y + button_height);

if(point_in_rect) {
     // light gray if over, dark gray if held down
    if(mouse_held) {
        //c_dkgray;
        color = c_black;
        color_txt = c_white;
    } else {
        //c_ltgray;
        color = c_ltgray;
        color_txt = c_black;
    }

    if mouse_check_button_released(mb_left)
    {
        instance_destroy();
    }
}

draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, color , c_black, 1);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_color(color_txt);
draw_text(button_x + (button_width / 2), button_y + (button_height / 2), message_button);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_color(c_white);
 

luxo-JR

Member
I found this is a problem with the last parameter of 'draw_roundrect_colour', it should be set to 0 (area filled with a color) and not to 1 (just an outline). It's partly settled. Thanks everyone.


Hello and thank you for your response. I have to modify the code a bit (very slightly), but the bug remains. The display of the box works but it is the display of the 'OK' button which is in error. It does not take into account the 'color_background' and 'color_txt' instructions. When I am on the (over) button, nothing happens (I tested, the point_in_rectange works), no color change for the background and for the text. On the other hand for the click (mouse_held), the text becomes white and the background remains unchanged. I do not understand. Thank you.

GML:
var box_width = 5 + string_width(message_box) + 5;
var button_height = 5 + string_height(message_button) + 5;
var box_height = 5 + string_height(message_box) + 10 + button_height;
var box_x = ceil((room_width / 2) - (box_width / 2));
var box_y = ceil((room_height / 2) - (box_height / 2));

var button_width = 10 + string_width(message_button) + 10;
//button_height = 5 + string_height(message_button) + 5
var button_x = ceil(room_width / 2) - ceil(button_width / 2);
var button_y = box_y + button_height;

draw_set_colour(c_white);
draw_roundrect(box_x, box_y, box_x + box_width, box_y + box_height, 0);
draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, c_white, c_black, 1);
draw_set_colour(c_black);
draw_set_halign(fa_center);
draw_set_valign(fa_bottom);
draw_text(box_x + (box_width / 2), box_y + (box_height / 2), message_box);

var color_background = c_white; // the default button color_backgroud
var color_txt = c_black;
var mouse_held =  mouse_check_button(mb_left);
var point_in_rect = point_in_rectangle(mouse_x, mouse_y, button_x, button_y, button_x + button_width, button_y + button_height);


if(point_in_rect) {
     // light gray if over, dark gray if held down
    if(mouse_held) {
        //c_dkgray;
        color_background = c_dkgray;
        color_txt = c_white;
        //draw_roundrect_colour(50, 50, 100, 100, c_dkgray, c_aqua, 1);
    } else {
        //c_ltgray;
        color_background = c_ltgray;
        color_txt = c_black;
        //draw_roundrect_colour(150, 150, 200, 200, c_ltgray, c_red, 1);
    }

    if mouse_check_button_released(mb_left)
    {
        instance_destroy();
    }
}

draw_roundrect_colour(button_x, button_y, button_x + button_width, button_y + button_height, color_background, c_black, 1);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_colour(color_txt);
draw_text(button_x + (button_width / 2), button_y + (button_height / 2), message_button);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_set_colour(c_white);
 
Last edited:
Top