Hi again,
I've started working on a mini-window that will show an image of a map. I want to be able to zoom in and zoom out the image using the mouse. Being able to drag it around would be neat too.
I've searched around and couldn't find any information on how to accomplish something like this, besides with text maps.
Could someone point me into the right direction how I would go about doing something like this?
Here's what I've managed to piece together from various forum posts. Right now I'm just trying it with one image to see if I could get it working before getting more complicated with it. The Hotspot part of the code... is just a bad attempt for zooming in that I took out of some post reply here.
Window creates fine, and shows the map image.
Assuming you would have to redraw the window every time you zoomed in or out, but being able to drag it around? How could that work?
I've started working on a mini-window that will show an image of a map. I want to be able to zoom in and zoom out the image using the mouse. Being able to drag it around would be neat too.
I've searched around and couldn't find any information on how to accomplish something like this, besides with text maps.
Could someone point me into the right direction how I would go about doing something like this?
Here's what I've managed to piece together from various forum posts. Right now I'm just trying it with one image to see if I could get it working before getting more complicated with it. The Hotspot part of the code... is just a bad attempt for zooming in that I took out of some post reply here.
Window creates fine, and shows the map image.
function show_map ()
map_window = GetPluginID()
map_width = 500
map_height = 500
check (WindowCreate (map_window, -- window ID
0, -- left
0, -- top
map_width, -- width
map_height, -- depth
0, -- center it
2,
0)) -- background colour
-- load the map image
check (WindowLoadImage (map_window, "map", GetInfo (66) .. "Maps/Woods_Map.png"))
-- draw it
check (WindowDrawImage (map_window, "map", 0, 0, 0, 0, 2)) -- draw it
check (WindowAddHotspot(map_window, "map", 0, 0, map_width,map_height, "", "", "", "", "mouseup", "Zoom", 10, 0))
-- show the window
WindowShow (map_window, true)
end -- show_map
Assuming you would have to redraw the window every time you zoomed in or out, but being able to drag it around? How could that work?