summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 1b7331ee2..10e01be2a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -403,6 +403,7 @@ Doing currently:
#include "game.h"
#include "keycode.h"
#include "tile.h"
+#include "chat.h"
#include "defaultsettings.h"
#include "gettext.h"
#include "settings.h"
@@ -940,20 +941,20 @@ void drawMenuBackground(video::IVideoDriver* driver)
driver->getTexture(getTexturePath("menubg.png").c_str());
if(bgtexture)
{
- s32 texturesize = 128;
- s32 tiled_y = screensize.Height / texturesize + 1;
- s32 tiled_x = screensize.Width / texturesize + 1;
+ s32 scaledsize = 128;
- for(s32 y=0; y<tiled_y; y++)
- for(s32 x=0; x<tiled_x; x++)
- {
- core::rect<s32> rect(0,0,texturesize,texturesize);
- rect += v2s32(x*texturesize, y*texturesize);
- driver->draw2DImage(bgtexture, rect,
- core::rect<s32>(core::position2d<s32>(0,0),
- core::dimension2di(bgtexture->getSize())),
- NULL, NULL, true);
- }
+ // The important difference between destsize and screensize is
+ // that destsize is rounded to whole scaled pixels.
+ // These formulas use component-wise multiplication and division of v2u32.
+ v2u32 texturesize = bgtexture->getSize();
+ v2u32 sourcesize = texturesize * screensize / scaledsize + v2u32(1,1);
+ v2u32 destsize = scaledsize * sourcesize / texturesize;
+
+ // Default texture wrapping mode in Irrlicht is ETC_REPEAT.
+ driver->draw2DImage(bgtexture,
+ core::rect<s32>(0, 0, destsize.X, destsize.Y),
+ core::rect<s32>(0, 0, sourcesize.X, sourcesize.Y),
+ NULL, NULL, true);
}
video::ITexture *logotexture =
@@ -1479,6 +1480,8 @@ int main(int argc, char *argv[])
GUI stuff
*/
+ ChatBackend chat_backend;
+
/*
If an error occurs, this is set to something and the
menu-game loop is restarted. It is then displayed before
@@ -1663,7 +1666,8 @@ int main(int argc, char *argv[])
address,
port,
error_message,
- configpath
+ configpath,
+ chat_backend
);
} //try