change mouse press behaviour

This commit is contained in:
Eduardo Bart 2012-04-07 00:37:29 -03:00
parent 2835a66bab
commit 2e43a77d64
4 changed files with 9 additions and 8 deletions

View File

@ -60,6 +60,7 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
((Mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or ((Mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or
(Mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then (Mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
local tile = self:getTile(mousePosition) local tile = self:getTile(mousePosition)
print(tile:getTopLookThing():getId())
g_game.look(tile:getTopLookThing()) g_game.look(tile:getTopLookThing())
self.cancelNextRelease = true self.cancelNextRelease = true
return true return true

View File

@ -89,8 +89,8 @@ uint Texture::internalLoadGLTexture(uchar *pixels, int channels, int width, int
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_size.width(), m_size.height(), 0, format, GL_UNSIGNED_BYTE, pixels); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_size.width(), m_size.height(), 0, format, GL_UNSIGNED_BYTE, pixels);
// disable texture border // disable texture border
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
setupFilters(); setupFilters();

View File

@ -1383,10 +1383,10 @@ bool UIWidget::onMousePress(const Point& mousePos, Fw::MouseButton button)
m_lastClickPosition = mousePos; m_lastClickPosition = mousePos;
} }
if(hasLuaField("onMousePress")) { if(hasLuaField("onMousePress"))
return callLuaField<bool>("onMousePress", mousePos, button); return callLuaField<bool>("onMousePress", mousePos, button);
}
return true; return false;
} }
bool UIWidget::onMouseRelease(const Point& mousePos, Fw::MouseButton button) bool UIWidget::onMouseRelease(const Point& mousePos, Fw::MouseButton button)

View File

@ -48,7 +48,7 @@ ItemPtr Item::create(int id)
} }
PainterShaderProgramPtr itemProgram; PainterShaderProgramPtr itemProgram;
//int ITEM_ID_UNIFORM = 10; int ITEM_ID_UNIFORM = 10;
void Item::draw(const Point& dest, float scaleFactor, bool animate) void Item::draw(const Point& dest, float scaleFactor, bool animate)
{ {
@ -167,11 +167,11 @@ void Item::draw(const Point& dest, float scaleFactor, bool animate)
itemProgram->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader); itemProgram->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader);
itemProgram->addShaderFromSourceFile(Shader::Fragment, "/game_shaders/item.frag"); itemProgram->addShaderFromSourceFile(Shader::Fragment, "/game_shaders/item.frag");
itemProgram->link(); itemProgram->link();
//itemProgram->bindUniformLocation(ITEM_ID_UNIFORM, "itemId"); itemProgram->bindUniformLocation(ITEM_ID_UNIFORM, "itemId");
} }
g_painter.setCustomProgram(itemProgram); g_painter.setCustomProgram(itemProgram);
itemProgram->bind(); itemProgram->bind();
//itemProgram->setUniformValue(ITEM_ID_UNIFORM, (int)m_id); itemProgram->setUniformValue(ITEM_ID_UNIFORM, (int)m_id);
// now we can draw the item // now we can draw the item
internalDraw(dest, scaleFactor, xPattern, yPattern, zPattern, animationPhase); internalDraw(dest, scaleFactor, xPattern, yPattern, zPattern, animationPhase);