Simple Textbox like Final Fantasy

F

FourOhForum

Guest
Alright so I'm using the textbox used in the Shaun Spalding tutorial for textboxes.
He gives it an outline and I started thinking, hey I could make four outlines to make the FF text box.
So I changed it to the round rectangle, and did this:

draw_set_color(c_blue);
draw_roundrect(x,y,x+box_width,y+box_height,0);
draw_set_color(c_black);
draw_roundrect(x,y,x+box_width,y+box_height,2);
draw_set_color(c_white);
draw_roundrect(x,y,x+box_width,y+box_height,6);
draw_set_color(c_black);
draw_roundrect(x,y,x+box_width,y+box_height,8);

I thought this was clever until I realized that it draws the blue box fine, always. But then the outlines are all not going beyond 1 pixel.

How do I fix this?
 

NicoDT

Member
Hey, you´re using draw_roundrect wrong.

This is what the document says:
draw_roundrect(x1, y1, x2, y2, outline);
outline: Whether the rounded rectangle is drawn filled (false) or as a one pixel wide outline (true).
You should change the coordinates to make it work fine. Try something like this.

Code:
draw_set_color(c_black);
draw_roundrect(x-4,y-4,x+box_width+4,y+box_height+4,0);
draw_set_color(c_white);
draw_roundrect(x-3,y-3,x+box_width+3,y+box_height+3,0);
draw_set_color(c_black);
draw_roundrect(x-1,y-1,x+box_width+1,y+box_height+1,0);
draw_set_color(c_blue);
draw_roundrect(x,y,x+box_width,y+box_height,0);
Anyway, I´d use a sprite instead of using the draw_roundrect function.
 
F

FourOhForum

Guest
Hey, you´re using draw_roundrect wrong.

This is what the document says:


You should change the coordinates to make it work fine. Try something like this.

Code:
draw_set_color(c_black);
draw_roundrect(x-4,y-4,x+box_width+4,y+box_height+4,0);
draw_set_color(c_white);
draw_roundrect(x-3,y-3,x+box_width+3,y+box_height+3,0);
draw_set_color(c_black);
draw_roundrect(x-1,y-1,x+box_width+1,y+box_height+1,0);
draw_set_color(c_blue);
draw_roundrect(x,y,x+box_width,y+box_height,0);
Anyway, I´d use a sprite instead of using the draw_roundrect function.
It's working perfectly. Thank you.
I knew I had to be making some kind of simple mistake.

I'd rather not use a sprite, but I appreciate the suggestion.
 
Top