Also important is that although highlighting literarily means that to put importance to something, in computer terms we often say it and mean the visual effect as when you select a text. I will do the visual effect. It may also be used to select a text, and then the program will know which text. This example has several advantages. If there is something you don’t understand how to do with this example, just ask on, by commenting preferably.
Here is the property of the single object that I use:
<b>Create Event:</b>
execute code:
highlight = false;
offset = 5;
some_text = "This is the test text!";
<b>Mouse Event for Glob Left Button:</b>
execute code:
if (mouse_x<x+string_width(some_text)) && (mouse_x>x) &&
(mouse_y<y+string_height(some_text)) && (mouse_y>y) {
highlight = true;
//Now I copy the text to the clipboard, can be removed:
clipboard_set_text(some_text);
}
else {
highlight = false;
}
<b>
raw Event:</b>execute code:
draw_set_color(c_blue);
if (highlight == true) {
//This is a visual effect, which may be removed!
draw_rectangle(x-offset,y-offset,x+string_width(some_text)+offset,y
+string_height(some_text)+offset,false);
}
draw_set_color(c_black);
draw_text(x,y,some_text);
As you may see in the code there are a few places where I have commented and said something like that the following piece of code can be deleted. It could also be replaced by something custom. Keep that in mind. The visual effect could be changed for an example, and maybe you didn’t want to copy the text to the clipboard, so you could replace that with anything else that you actually want to do.
Good luck with your creations, instead of explaining how this thing work (you’ll have to figure that out yourself, or ask), I’ll just post the example...
<b>Example:</b> http://gmtutorials.com/files/highlighttxt.gm6
Comments
Loading comments...