GMS 2 (SOLVED) draw_rectangle draws semi transparent pixels on fill and some other things

Discussion in 'Programming' started by Shadowblitz16, Dec 24, 2018.

  1. Shadowblitz16

    Shadowblitz16 Member

    Joined:
    Jun 23, 2016
    Posts:
    595
    does anybody know why draw_rectangle(0,7,127,7,false) is drawing a semi transparent rectangle?
    upload_2018-12-24_15-54-0.png

    also it seems that the lines top, left, and right lines are not drawing even though 0-7 is 8 pixels and
    0-127 is 128 pixels which it should be drawing inside the rectangle like this..
    upload_2018-12-24_15-53-14.png

    here is my code
    Code:
    /// @description Create event of obj_game
    
    depth = 1000;
    
    global.font = font_add_sprite_ext(spr_font, " !\"#$%'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", true, 0)
    global.save = ds_map_create();
    global.palette =
    [
        make_color_rgb(000, 000, 000), 
        make_color_rgb(032, 051, 123), 
        make_color_rgb(126, 037, 083), 
        make_color_rgb(000, 131, 049),
        make_color_rgb(171, 082, 054), 
        make_color_rgb(069, 069, 069), 
        make_color_rgb(194, 195, 199), 
        make_color_rgb(255, 241, 232),
        make_color_rgb(255, 000, 077), 
        make_color_rgb(255, 163, 000), 
        make_color_rgb(255, 231, 039), 
        make_color_rgb(000, 226, 050),
        make_color_rgb(041, 173, 255), 
        make_color_rgb(131, 118, 156), 
        make_color_rgb(255, 119, 168), 
        make_color_rgb(255, 204, 170)
    ]
    
    game_set_speed(30, gamespeed_fps)
    
    Code:
    /// @description Draw end event of obj_game
    
    
    draw_set_alpha(1);
    draw_set_color(global.palette[7])
    draw_rectangle(0, 7, 127, 7, true)
    
    draw_set_color(global.palette[2])
    draw_rectangle(0, 7, 127, 7, false)
    
    Code:
    /// @description Room change event of obj_game
    
    
    surface_resize(application_surface, room_width, room_height)
    
     
  2. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,469
    Why is your rectangle's starting and ending y coordinates the same? That doesn't give a rectangle, that gives a line.
     
  3. Shadowblitz16

    Shadowblitz16 Member

    Joined:
    Jun 23, 2016
    Posts:
    595
    I feel stupid now that i didn't see that.
    thank you for pointing this out.

    I will mark it as solved since it now draw like in the image i posted.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice