text box to top left corner of room-image included

T

Tenten2016

Guest
In the Object's Draw Event

if (time < text_length)
{
time += spd;
print = string_copy(text,0,time)
}


Render Text box code:

draw_set_alpha(alpha);
if (alpha < 1) alpha += spd/10; else alpha = 1;

draw_set_font(font0);
draw_set_color(c_blue);
draw_rectangle(x,y,x+boxwidth,y+boxheight,0);
draw_set_color(c_black);
draw_rectangle(x,y,x+boxwidth,y+boxheight,1);

draw_set_color(c_white);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
draw_text_ext
(
x + padding,
y + padding,
print,
font_size+(font_size/2),
maxlength
);
draw_set_alpha(1);

_______

I'm not able to find any resources here on GMC, Reddit, or Youtube that teaches you how to manipulate the code to put the textbox and the text in different areas in the room. How can I make my text box be position like this image?
 
N

NizarPlayz

Guest
Im not sure if it works for you but
try making an image of your text written in a box then add the sprite spr_text
and create object with event create and use this sprite_ functions
 
T

Tenten2016

Guest
Im not sure if it works for you but
try making an image of your text written in a box then add the sprite spr_text
and create object with event create and use this sprite_ functions
That's the easy way. Of course I could even go into photoshop and make an png image and use that as an object and post it in the room in the position I'd like it be. But no, I'm wanting to do this with code.
 
N

NizarPlayz

Guest
That's the easy way. Of course I could even go into photoshop and make an png image and use that as an object and post it in the room in the position I'd like it be. But no, I'm wanting to do this with code.
As i said ("use this sprite_ functions") do you know what i mean by sprite_? meaning use the sprite_ codes
 
T

Tenten2016

Guest
As i said ("use this sprite_ functions") do you know what i mean by sprite_? meaning use the sprite_ codes
Yes I do...but I'm having trouble understanding why I have to go out of my object_textbox just so as to make the textbox move to the top left corner. I figured I could just change some x and y's. Nonetheless, I'll try the sprite_codes and see what happens.
 
T

Tenten2016

Guest
But why would I want to use an sprite code if I don't even have an sprite?
 
N

NizarPlayz

Guest
But why would I want to use an sprite code if I don't even have an sprite?
Dude i meant to said that make a sprite of text box spr_textbox then make object and select the sprite and use the code umm idk if there is a function for that sprite_show
 
T

Tenten2016

Guest
Dude i meant to said that make a sprite of text box spr_textbox then make object and select the sprite and use the code umm idk if there is a function for that sprite_show
OOOOOOOOOOO!!!! Okay
 
T

TesloStep

Guest
hi. first, you can use draw_gui event, and stuff like x=window_windth/2 to center you text box on screen or x=32 to pin it almost left, you got it.
second - you can use string_height() and string_width() to get size of your text, if you need that.
 
T

Tenten2016

Guest
hi. first, you can use draw_gui event, and stuff like x=window_windth/2 to center you text box on screen or x=32 to pin it almost left, you got it.
second - you can use string_height() and string_width() to get size of your text, if you need that.
I don't want to doubt you guys but I think I need to be in the Draw Event and I think I need to be focusing
draw_text(x,y,value);

Thoughts, comments, concerns =0?
 
T

Tenten2016

Guest
So upon doing some research the textbox isn't suppose to be done in GUI event in regards to my situation.
 
T

Tenten2016

Guest
I watched Shawn's video. And in the video he shows you are to create an text box with text. However when you get to the end of the video, the textbox is in the center of the room. I'm trying to get the text box to be at the top left corner of the room. In the tutorial, he doesn't tell you how to manipulate coordinates so as you can move the text box around. In the video he uses Script, and Draw Event.
 
T

Tenten2016

Guest
just change its x and y variables
To be honest, I did that...

draw_set_font(font0);
draw_set_color(c_blue);
draw_rectangle(x,y,x+boxwidth,y+boxheight,0);
draw_set_color(c_black);
draw_rectangle(x,y,x+boxwidth,y+boxheight,1);

Changing it to 0,0 makes the box at the top left corner of the room, but the box is also bigger, and the text is still in the center of the room.
 
T

TesloStep

Guest
no, you dont need to replace x and y with other numbers. you must do something like
Code:
x=32
y=32

draw_set_font(font0);
draw_set_color(c_blue);
draw_rectangle(x,y,x+boxwidth,y+boxheight,0);
draw_set_color(c_black);
draw_rectangle(x,y,x+boxwidth,y+boxheight,1);
 
T

Tenten2016

Guest
Changing draw_rectangle allows me to move the box up and down, but I'm not able to move the text with it.
 
T

Tenten2016

Guest
no, you dont need to replace x and y with other numbers. you must do something like
Code:
x=32
y=32

draw_set_font(font0);
draw_set_color(c_blue);
draw_rectangle(x,y,x+boxwidth,y+boxheight,0);
draw_set_color(c_black);
draw_rectangle(x,y,x+boxwidth,y+boxheight,1);

Thank you, I'll give it a go. See what happens.
 
T

Tenten2016

Guest
no, you dont need to replace x and y with other numbers. you must do something like
Code:
x=32
y=32

draw_set_font(font0);
draw_set_color(c_blue);
draw_rectangle(x,y,x+boxwidth,y+boxheight,0);
draw_set_color(c_black);
draw_rectangle(x,y,x+boxwidth,y+boxheight,1);
I can't believe that's all I had to do! I rarely come on this site because I usually don't get stumped. I even forgot my old account logins as a result and just made this one a few months back, just in case I got stuck on something again. Yep, and this was it. Thank you all for helping me; the issue is now RESOLVED.
 
Last edited by a moderator:
Top