Draw_Shape Functions Incorrect

Ragster

Member
So I'm having a problem drawing shapes. Some of the positioning is off, looking at the image below and the code corresponding to it. The top 2 bars are being drawn twice as large due to a setting in-game. The bottom 2 bars are being drawn at regular 1:1 size. As you can see the lines in the middle are sometimes 1 pixel off, yet the code draws each line similarly. I'm having a hard time figuring out what is causing this.

error.png

The script that draws health bars:
Code:
/// interface_bar(x,y,w,h,color,segments,length)
var seg = argument2/(max(argument5,1));
var c1 = merge_colour(argument4,0,0.4);
var c2 = merge_colour(argument4,0,0.8);
draw_rectangle_colour(argument0,argument1,argument0+argument2-1,argument1+argument3-1,c1,c1,c1,c1,false);
draw_rectangle_colour(argument0,argument1,argument0+(argument2*clamp(argument6,0,1))-1,argument1+argument3-1,argument4,argument4,argument4,argument4,false);
draw_rectangle_colour(argument0,argument1,argument0+argument2-1,argument1+argument3-1,c2,c2,c2,c2,true);
for (var i = 1; i < argument5; i++) draw_line_colour(argument0+(i*seg),argument1-1,argument0+(i*seg),argument1+argument3-1,c2,c2);
The object that draws the bars, in the Draw GUI event:
Code:
interface_bar((global.gui_width*0.5)-225,global.gui_height-8,450,5,interface_color_secondary,8,content.save[?"player.health"]);
interface_bar((global.gui_width*0.5)-225,global.gui_height-17,450,5,interface_color_primary,8,content.save[?"player.energy"]);
The object that sets the GUI size from a user setting:
Code:
global.gui_scale = content.data[?"config.video.interface_scale"];
global.gui_width = floor(global.display_width/global.gui_scale);
global.gui_height = floor(global.display_height/global.gui_scale);
display_set_gui_maximise(global.gui_scale,global.gui_scale);
 

Ido-f

Member
The object that draws the bars, in the Draw GUI event:
Code:
interface_bar((global.gui_width*0.5)-225,global.gui_height-8,450,5,interface_color_secondary,8,content.save[?"player.health"]);
interface_bar((global.gui_width*0.5)-225,global.gui_height-17,450,5,interface_color_primary,8,content.save[?"player.energy"]);
Maybe you changed the gui scale but didn't adjust the x-offset?
That would make the hard-coded -225 wrong.
 
Top