Since I updated from v4.40 to v4.30, some of my plugins don't function as they should anymore.
More specifically, the WindowDrawImage() function is what keeps them from showing what I want them to show.
I use mode 3 (transparent copy) to make 'overlays'. I could -probably- do this with WindowDrawImageAlpha(), but my question is: why doesn't mode 3 work like it used to?
In case I coded something wrong, here's one of the plugins:
winid = world.GetPluginID
path = world.GetPluginInfo(winid, 20)
background_colour = world.ColourNameToRGB("black")
start_colour = world.ColourNameToRGB("darkslateblue")
end_colour = world.ColourNameToRGB("turquoise")
# Window size
win_height = 586
win_width = 37
# Initial Gauge Height (when XP = 0)
gauge_height = 535
# Gauge Length = 535 - 50 = 485
def OnPluginBroadcast(msg, id, name, text):
if id == "65b2f9550e9da2d141111e74":
if msg == 300:
ComputeGaugeHeight(text)
return 0
def ComputeGaugeHeight(text):
global gauge_height
text_list = text.split('!')
XP_current = float(text_list[6])
XP_needed = float(text_list[7])
XP_ratio = XP_current/XP_needed
gauge_height = int(535 - (485*XP_ratio))
DrawGauge()
def OnPluginInstall():
world.WindowCreate(winid, 0, 0, win_width, win_height, 6, 4, background_colour)
world.WindowLoadImage(winid, "xp_bar", path+"xp_bar.png")
DrawGauge()
world.WindowShow(winid, True)
def DrawGauge():
world.WindowRectOp(winid, 2, 0, 0, win_width, win_height, background_colour, background_colour)
world.WindowGradient(winid, 13, gauge_height, 18, win_height, start_colour, end_colour, 1)
world.WindowGradient(winid, 18, gauge_height, 24, win_height, end_colour, start_colour, 1)
world.WindowDrawImage(winid, "xp_bar", 0, 0, win_width, win_height, 3, 0, 0, 0, 0)
world.WindowShow(winid, True)
|