Remake cursors, closes #219 and #237

This commit is contained in:
Eduardo Bart
2013-01-25 11:17:51 -02:00
parent 0a91fff82a
commit 3a47c4f2e1
23 changed files with 217 additions and 112 deletions

View File

@@ -19,6 +19,8 @@ function init()
g_particles.importParticle('/particles/' .. particle)
end
end
g_mouse.loadCursors('/cursors/cursors')
end
function terminate()

View File

@@ -27,10 +27,10 @@ function UIResizeBorder:onHoverChange(hovered)
if hovered then
if g_mouse.isCursorChanged() or g_mouse.isPressed() then return end
if self:getWidth() > self:getHeight() then
g_mouse.setVerticalCursor()
g_mouse.setCursor('vertical')
self.vertical = true
else
g_mouse.setHorizontalCursor()
g_mouse.setCursor('horizontal')
self.vertical = false
end
self.hovering = true

View File

@@ -14,10 +14,10 @@ function UISplitter:onHoverChange(hovered)
if hovered and (self:canUpdateMargin(margin + 1) ~= margin or self:canUpdateMargin(margin - 1) ~= margin) then
if g_mouse.isCursorChanged() or g_mouse.isPressed() then return end
if self:getWidth() > self:getHeight() then
g_mouse.setVerticalCursor()
g_mouse.setCursor('vertical')
self.vertical = true
else
g_mouse.setHorizontalCursor()
g_mouse.setCursor('horizontal')
self.vertical = false
end
self.hovering = true

View File

@@ -235,7 +235,7 @@ function startChooseItem()
connect(mouseGrabberWidget, { onMouseRelease = onChooseItemMouseRelease })
mouseGrabberWidget:grabMouse()
g_mouse.setTargetCursor()
g_mouse.setCursor('target-cursor')
hide()
end

View File

@@ -331,14 +331,14 @@ function startUseWith(thing)
selectedType = 'use'
selectedThing = thing
mouseGrabberWidget:grabMouse()
g_mouse.setTargetCursor()
g_mouse.setCursor('target')
end
function startTradeWith(thing)
selectedType = 'trade'
selectedThing = thing
mouseGrabberWidget:grabMouse()
g_mouse.setTargetCursor()
g_mouse.setCursor('target')
end
function createThingMenu(menuPosition, lookThing, useThing, creatureThing)

View File

@@ -16,7 +16,8 @@ function UIGameMap:onDragEnter(mousePos)
if not thing then return false end
self.currentDragThing = thing
g_mouse.setTargetCursor()
g_mouse.setCursor('target')
self.allowNextRelease = false
return true
end

View File

@@ -6,7 +6,7 @@ function UIItem:onDragEnter(mousePos)
self:setBorderWidth(1)
self.currentDragThing = item
g_mouse.setTargetCursor()
g_mouse.setCursor('target')
return true
end