aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2011-12-03 09:01:14 +0100
committerPerttu Ahola <celeron55@gmail.com>2012-03-10 20:11:10 +0200
commit967f25461bbde28dbc0247fa1c491e9d9938a5b2 (patch)
treed1e26464862551db3f1d12627cdbe9e31fe211a9 /src/main.cpp
parent00536518142a586f3fc51a07f76e12085e3cbd30 (diff)
downloadminetest-967f25461bbde28dbc0247fa1c491e9d9938a5b2.tar.gz
minetest-967f25461bbde28dbc0247fa1c491e9d9938a5b2.tar.bz2
minetest-967f25461bbde28dbc0247fa1c491e9d9938a5b2.zip
Chat console, including a number of rebases and modifications.
Defaults modified from original: alpha=200, key=F10
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