-- this is how I load them
file_path = (GetPluginInfo (GetPluginID (), 6)):match("^(.*\).*$")
local directions = {"n", "ne", "e", "se", "s", "sw", "w", "nw"}
for _, v in ipairs(directions) do
WindowLoadImage (win, v, file_path.."arrows\"..v..".bmp")
end
------------------------------------------------------
--below are the functions I use that draw them
local function give_direction(exit)
if exit == "n" then return 0, 1 end
if exit == "ne" then return 1, 1 end
if exit == "e" then return 1, 0 end
if exit == "se" then return 1, -1 end
if exit == "s" then return 0, -1 end
if exit == "sw" then return -1, -1 end
if exit == "w" then return -1, 0 end
if exit == "nw" then return -1, 1 end
end
local function draw_exit(x_pos, y_pos, exit_dir, arrow_dir, exit_colour)
x_dir, y_dir = give_direction(exit_dir)
local exit_center_x = mw_buffer_x + (x_pos*block_x) - (block_x/2) + ((room_width + exit_width)/2)*x_dir
local exit_center_y = mw_buffer_y + (y_pos*block_y) + ((room_height + exit_height)/2)*-y_dir
local x1 = exit_center_x - exit_width/2
local y1 = exit_center_y - exit_height/2
local x2 = exit_center_x + exit_width/2
local y2 = exit_center_y + exit_height/2
if arrow_dir then WindowDrawImage (win, arrow_dir, x1+2, y1+2, x2-2, y2-2, 2) end
WindowCircleOp (win, 2,
x1, y1, x2, y2,
ColourNameToRGB(exit_colour), 0, 1,
ColourNameToRGB("black"), miniwin.brush_null)
end
-- I commented out the WindowDragImage line and the code ran literally 100x faster. I emulate mush on wine, perhaps that's why I'm having performance issues? |