Kezarus
Endless Game Maker
Hi everyone!
So, I am drawing everything into a surface and retaining that as a tooltip.
Problem is, all black lines goes transparent and I don't know why. Take a very closer look on the attached image. The issue is around the fonts and the map symbol.
I tried additive blending, clear the surface with and without alpha, drew a black rectangle, etc. All to no avail.
This is what I do at the start of the event that draws the surface. The event is a user event that is called on the Draw GUI event.
This is inside the same event and I use it to draw the buildings tooltip
This is the draw_text_outline:
And this is at the end of the event:
The font is anti-aliased and the sprite have some transparency. Any insight on what is happening will be greatly appreciated.
Thanks!
Kezarus
So, I am drawing everything into a surface and retaining that as a tooltip.
Problem is, all black lines goes transparent and I don't know why. Take a very closer look on the attached image. The issue is around the fonts and the map symbol.
I tried additive blending, clear the surface with and without alpha, drew a black rectangle, etc. All to no avail.
This is what I do at the start of the event that draws the surface. The event is a user event that is called on the Draw GUI event.
Code:
///CLEAN & CREATE SURFACE
if( surface_exists(TooltipSurface) ){
surface_free(TooltipSurface);
}
TooltipSurface = surface_create( surfaceWidth, 768 );
surface_set_target(TooltipSurface);
draw_clear_alpha(c_black,0);
//DON'T WORK
//draw_set_blend_mode(bm_add);
/*draw_set_alpha(1);
draw_set_colour(c_black);
draw_rectangle(0, 0, surfaceWidth, 768, false);*/
draw_panel( surfaceWidth, 768, c_dkgray, 0, 0 );
Code:
///CREATE SURFACE - BUILDING
if( TooltipObj.object_index == objBuilding ){
var wy = 0;
var text = "";
//PREPARE DRAW NAME
draw_set_alpha(1);
draw_set_colour(c_white);
draw_set_halign(fa_center);
draw_set_valign(fa_top);
draw_set_font(fntTownNames);
//PREPARE DRAW HERALDRY
var HeraldrySize = sprite_get_height(sprHeraldryBack);
var wx = (surfaceWidth div 2)-(HeraldrySize div 2);
var wType = TooltipObj.Type;
var centerX = surfaceWidth div 2;
with(TooltipObj.TownOwner){
//DRAW NAME
draw_text_outline( centerX, wy, Name, -1, 5000, c_black, 1, 0 );
wy += 25;
//DRAW TYPE
draw_set_font(fntTooltip);
draw_text_outline( centerX, wy, TownBuildToText(wType), -1, 5000 );
wy += 18;
//DRAW HERALDRY
draw_sprite_stretched_ext(sprHeraldryBack, 0,
wx, wy, HeraldrySize, HeraldrySize, HeraldryColor1, 1);
draw_sprite_stretched_ext(sprHeraldryPatterns, HeraldryPattern,
wx, wy, HeraldrySize, HeraldrySize, HeraldryColor2, 1);
draw_sprite_stretched_ext(sprHeraldrySymbols, HeraldrySymbol,
wx, wy, HeraldrySize, HeraldrySize, HeraldryColor3, 1);
}
with(TooltipObj){
draw_set_font(fntTooltip);
wy += HeraldrySize+5;
draw_text_outline( centerX, wy, "HP:" + string(ceil(HitPoints)), -1, 5000 );
if(DaysToFinish > 0){
wy += 14;
text = string(DaysToFinish) + " days to finish";
draw_text_outline( centerX, wy, text, -1, 5000 );
}
draw_set_halign(fa_left);
wy += (14*2);
draw_text_outline( 10, wy, TownBuildingDescription(wType), -1, other.surfaceWidth-20 );
}
}
Code:
/// draw_text_outline(x, y, text, separation, width, *outline_color, *scale, *angle);
/*
separation - The distance in pixels between lines of
text as if the string was being drawn.
width - The maximum width (in pixels) of the string
before a line break as if the string was bring drawn.
*/
var
x1 = argument[0],
y1 = argument[1],
text = argument[2],
wSep = argument[3],
wWidth = argument[4],
wScale = 1,
wAngle = 0,
c1 = c_black;
var c2 = draw_get_colour();
if (argument_count > 5){ c1 = argument[5]; }
if (argument_count > 6){ wScale = argument[6]; }
if (argument_count > 7){ wAngle = argument[7]; }
draw_set_alpha(1);
draw_set_color(c1);
draw_text_ext_transformed(x1+1, y1+0, text, wSep, wWidth, wScale, wScale, wAngle);
draw_text_ext_transformed(x1-1, y1+0, text, wSep, wWidth, wScale, wScale, wAngle);
draw_text_ext_transformed(x1+0, y1+1, text, wSep, wWidth, wScale, wScale, wAngle);
draw_text_ext_transformed(x1+0, y1-1, text, wSep, wWidth, wScale, wScale, wAngle);
draw_set_color(c2);
draw_text_ext_transformed(x1, y1, text, wSep, wWidth, wScale, wScale, wAngle);
Code:
///RESET SURFACE TARGET
surface_reset_target();
Thanks!
Kezarus
Attachments
-
32.4 KB Views: 10