// Draw the textbox. // Set text properties. font_name = textFont; font_size = textSize; font_style = textStyle; // Check string width. while (string_width(myText) > sprite_width - 2 * textX) { myText = string_copy(myText, 1, string_length(myText) - 1); keyboard_string = myText; } tempWidth = string_width(myText); // If this textbox has focus, draw the text with the color "activeColor". if (focus) { // Draw the sprite. draw_sprite(sprite_index, 1, x, y); // Draw the text font_color = activeColor; draw_text(x + textX, y + textY, myText); // Draw the cursor if (cursorOn) { pen_color = activeColor; brush_color = activeColor; draw_rectangle(x + textX + tempWidth, y + cursorY, x + textX + tempWidth + 2, y + cursorY + 15); } } else { // Draw the sprite. draw_sprite(sprite_index, 0, x, y); // Draw "unfocused" text font_color = inactiveColor; draw_text(x + textX, y + textY, myText); }