Skip to content
Snippets Groups Projects
Commit 06732d3f authored by dg's avatar dg
Browse files

Right click on the minimap will now scroll the map

git-svn-id: http://svn.net-core.org/repos/t-engine4@2842 51575b47-30f0-44d4-a5cc-537603b46e54
parent f343fdd3
No related branches found
No related tags found
No related merge requests found
......@@ -59,9 +59,15 @@ function _M:generate()
self.rw, self.rh = w, h
self.frame = self:makeFrame("ui/button", self.w, self.h)
self.frame_sel = self:makeFrame("ui/button_sel", self.w, self.h)
-- Add a bit of padding
self.w = self.w + 6
self.h = self.h + 6
end
function _M:display(x, y, nb_keyframes)
x = x + 3
y = y + 3
if self.focused then
self:drawFrame(self.frame_sel, x, y)
self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3])
......
......@@ -788,7 +788,8 @@ function _M:display(nb_keyframes)
-- Minimap display
self.minimap_bg:toScreen(0, 35, 200, 200)
map:minimapDisplay(0, 35, util.bound(self.player.x - 25, 0, map.w - 50), util.bound(self.player.y - 25, 0, map.h - 50), 50, 50, 1)
self.minimap_scroll_x, self.minimap_scroll_y = util.bound(self.player.x - 25, 0, map.w - 50), util.bound(self.player.y - 25, 0, map.h - 50)
map:minimapDisplay(0, 35, self.minimap_scroll_x, self.minimap_scroll_y, 50, 50, 1)
end
-- We display the player's interface
......@@ -1129,7 +1130,10 @@ function _M:setupMouse(reset)
self.mouse:registerZone(0, 35, 200, 200, function(button, mx, my, xrel, yrel, bx, by, event)
if button == "left" and not xrel and not yrel and event == "button" then
local tmx, tmy = math.floor(bx / 4), math.floor(by / 4)
self.player:mouseMove(tmx, tmy)
self.player:mouseMove(tmx + self.minimap_scroll_x, tmy + self.minimap_scroll_y)
elseif button == "right" then
local tmx, tmy = math.floor(bx / 4), math.floor(by / 4)
game.level.map:moveViewSurround(tmx + self.minimap_scroll_x, tmy + self.minimap_scroll_y, 1000, 1000)
end
end)
if not reset then self.mouse:setCurrent() end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment