diff --git a/modules/corelib/ui/uiscrollbar.lua b/modules/corelib/ui/uiscrollbar.lua index 385031bf..ca9f8d87 100644 --- a/modules/corelib/ui/uiscrollbar.lua +++ b/modules/corelib/ui/uiscrollbar.lua @@ -102,8 +102,8 @@ end function UIScrollBar:onSetup() self.setupDone = true --signalcall(self.onValueChange, self, self.value) - g_mouse.bindAutoPress(self:getChildById('decrementButton'), function() self:decrement() end) - g_mouse.bindAutoPress(self:getChildById('incrementButton'), function() self:increment() end) + g_mouse.bindAutoPress(self:getChildById('decrementButton'), function() self:decrement() end, 300) + g_mouse.bindAutoPress(self:getChildById('incrementButton'), function() self:increment() end, 300) g_mouse.bindPressMove(self:getChildById('sliderButton'), function(mousePos, mouseMoved) parseSliderPos(self, mousePos) end) updateSlider(self) end diff --git a/modules/game_interface/widgets/uigamemap.lua b/modules/game_interface/widgets/uigamemap.lua index 3f0b7598..03469054 100644 --- a/modules/game_interface/widgets/uigamemap.lua +++ b/modules/game_interface/widgets/uigamemap.lua @@ -61,6 +61,10 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton) local localPlayerPos = g_game.getLocalPlayer():getPosition() local autoWalkPos = self:getPosition(mousePosition) + + -- happens when clicking outside of map boundaries + if not autoWalkPos then return false end + if autoWalkPos.z ~= localPlayerPos.z then local dz = autoWalkPos.z - localPlayerPos.z autoWalkPos.x = autoWalkPos.x + dz diff --git a/src/framework/graphics/texture.cpp b/src/framework/graphics/texture.cpp index 3bfc5084..5415d361 100644 --- a/src/framework/graphics/texture.cpp +++ b/src/framework/graphics/texture.cpp @@ -46,7 +46,7 @@ Texture::Texture(const Size& size) setupFilters(); } -Texture::Texture(const ImagePtr& image, bool buildMipmaps) +Texture::Texture(const ImagePtr& image, bool buildMipmaps, bool compress) { m_id = 0; @@ -67,11 +67,11 @@ Texture::Texture(const ImagePtr& image, bool buildMipmaps) if(buildMipmaps) { int level = 0; do { - setupPixels(level++, glImage->getSize(), glImage->getPixelData(), glImage->getBpp()); + setupPixels(level++, glImage->getSize(), glImage->getPixelData(), glImage->getBpp(), compress); } while(glImage->nextMipmap()); m_hasMipmaps = true; } else - setupPixels(0, glImage->getSize(), glImage->getPixelData(), glImage->getBpp()); + setupPixels(0, glImage->getSize(), glImage->getPixelData(), glImage->getBpp(), compress); setupWrap(); setupFilters(); @@ -216,7 +216,7 @@ void Texture::setupTranformMatrix() } } -void Texture::setupPixels(int level, const Size& size, uchar* pixels, int channels) +void Texture::setupPixels(int level, const Size& size, uchar* pixels, int channels, bool compress) { GLenum format = 0; switch(channels) { @@ -234,5 +234,9 @@ void Texture::setupPixels(int level, const Size& size, uchar* pixels, int channe break; } - glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, size.width(), size.height(), 0, format, GL_UNSIGNED_BYTE, pixels); + GLenum internalFormat = GL_RGBA; + if(compress) + internalFormat = GL_COMPRESSED_RGBA; + + glTexImage2D(GL_TEXTURE_2D, level, internalFormat, size.width(), size.height(), 0, format, GL_UNSIGNED_BYTE, pixels); } diff --git a/src/framework/graphics/texture.h b/src/framework/graphics/texture.h index 6498183c..562ef360 100644 --- a/src/framework/graphics/texture.h +++ b/src/framework/graphics/texture.h @@ -30,7 +30,7 @@ class Texture : public stdext::shared_object public: Texture(); Texture(const Size& size); - Texture(const ImagePtr& image, bool buildMipmaps = false); + Texture(const ImagePtr& image, bool buildMipmaps = false, bool compress = false); virtual ~Texture(); void bind(); @@ -57,7 +57,7 @@ protected: void setupWrap(); void setupFilters(); void setupTranformMatrix(); - void setupPixels(int level, const Size& size, uchar *pixels, int channels = 4); + void setupPixels(int level, const Size& size, uchar *pixels, int channels = 4, bool compress = false); uint m_id; Size m_size;