Merged master into ScriptEngine by resolving conflict in sources.cmake

This commit is contained in:
Sachith Hasaranga Seneviratne 2014-06-16 20:56:46 +05:30
commit 351643c851
24 changed files with 87 additions and 208 deletions

View File

@ -16,6 +16,7 @@ uniform mat4 ProjectionMatrix;
uniform mat4 InverseViewMatrix;
uniform mat4 InverseProjectionMatrix;
uniform mat4 ShadowViewProjMatrixes[4];
uniform vec2 screen;
#else
layout (std140) uniform MatrixesData
{

View File

@ -1,5 +1,6 @@
# Modify this file to change the last-modified date when you add/remove a file.
# This will then trigger a new cmake run automatically.
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")

View File

@ -133,19 +133,28 @@ void AchievementsStatus::sync(const std::vector<uint32_t> & achieved_ids)
std::map<uint32_t, Achievement*>::iterator i;
// String to collect all local ids that are not synched
// to the online account
std::string ids;
for(i=m_achievements.begin(); i!=m_achievements.end(); i++)
{
int id = i->second->getID();
unsigned int id = i->second->getID();
if(i->second->isAchieved() && (id>=done.size() || !done[id]) )
{
Log::info("Achievements", "Synching achievement %d to server.",
i->first);
Online::HTTPRequest * request = new Online::HTTPRequest(true,2);
PlayerManager::setUserDetails(request, "achieving");
request->addParameter("achievementid", i->second->getID());
request->queue();
ids=ids+StringUtils::toString(id)+",";
}
}
if(ids.size()>0)
{
ids.pop_back(); // delete the last "," in the string
Log::info("Achievements", "Synching achievement %d to server.",
ids.c_str());
Online::HTTPRequest * request = new Online::HTTPRequest(true, 2);
PlayerManager::setUserDetails(request, "achieving");
request->addParameter("achievementid", ids);
request->queue();
}
} // sync
// ----------------------------------------------------------------------------

View File

@ -1094,7 +1094,7 @@ namespace MeshShader
Program = LoadProgram(
GL_VERTEX_SHADER, file_manager->getAsset("shaders/grass_pass.vert").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getLightFactor.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/objectref_pass2.frag").c_str());
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/grass_pass2.frag").c_str());
attrib_position = glGetAttribLocation(Program, "Position");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
attrib_color = glGetAttribLocation(Program, "Color");

View File

@ -5,17 +5,19 @@
#ifndef __C_GUI_FONT_H_INCLUDED__
#define __C_GUI_FONT_H_INCLUDED__
#include "IrrCompileConfig.h"
#include "utils/leak_check.hpp"
#include "IrrCompileConfig.h"
#include "IGUIFontBitmap.h"
#include "irrString.h"
#include "irrMap.h"
#include "IXMLReader.h"
#include "IReadFile.h"
#include "irrArray.h"
#include <map>
#include "utils/leak_check.hpp"
#include <map>
#include <string>
namespace irr
{

View File

@ -1,109 +0,0 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2013 Glenn De Jonghe
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "online/messages.hpp"
#include "utils/translation.hpp"
#include "utils/time.hpp"
namespace Online
{
namespace Messages
{
irr::core::stringw signingIn()
{
return irr::core::stringw(_("Signing in")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw signingOut()
{
return irr::core::stringw(_("Signing out")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw validatingInfo()
{
return irr::core::stringw(_("Validating info")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw searching()
{
return irr::core::stringw(_("Searching")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw joiningServer()
{
return irr::core::stringw(_("Joining server")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw creatingServer()
{
return irr::core::stringw(_("Creating server")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw fetchingServers()
{
return irr::core::stringw(_("Fetching servers")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw fetchingFriends()
{
return irr::core::stringw(_("Fetching friends")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw fetchingAchievements()
{
return irr::core::stringw(_("Fetching achievements")) + loadingDots();
}
// ------------------------------------------------------------------------
irr::core::stringw processing()
{
return irr::core::stringw(_("Processing")) + loadingDots();
}
// ------------------------------------------------------------------------
/** Convenience function to type less in calls. */
irr::core::stringw loadingDots(const wchar_t *s)
{
return irr::core::stringw(s)+loadingDots();
}
// ------------------------------------------------------------------------
/**
* Shows a increasing number of dots.
* \param interval A float representing the time it takes to add a new dot
* \param max_dots The number of dots used. Defaults to 3.
*/
irr::core::stringw loadingDots(float interval, int max_dots)
{
int nr_dots = int(floor(StkTime::getRealTime() / interval)) % (max_dots+1);
return irr::core::stringw((std::string(nr_dots,'.') + std::string(max_dots-nr_dots,' ')).c_str());
}
} // namespace messages
} // namespace Online
/* EOF */

View File

@ -1,49 +0,0 @@
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2013 Glenn De Jonghe
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_ONLINE_MESSAGES_HPP
#define HEADER_ONLINE_MESSAGES_HPP
#include <string>
#include <irrString.h>
namespace Online
{
/**
* \brief Messages to be shown related to API communication
* \ingroup online
*/
namespace Messages
{
irr::core::stringw loadingDots (float interval = 0.5f, int max_dots = 3);
irr::core::stringw loadingDots (const wchar_t *s);
irr::core::stringw signingIn ();
irr::core::stringw signingOut ();
irr::core::stringw validatingInfo ();
irr::core::stringw searching ();
irr::core::stringw joiningServer ();
irr::core::stringw creatingServer ();
irr::core::stringw fetchingServers ();
irr::core::stringw fetchingFriends ();
irr::core::stringw fetchingAchievements ();
irr::core::stringw processing ();
} // namespace Messages
}// namespace Online
#endif
/* EOF */

View File

@ -24,7 +24,6 @@
#include "config/player_manager.hpp"
#include "modes/demo_world.hpp"
#include "online/servers_manager.hpp"
#include "online/messages.hpp"
#include "states_screens/online_screen.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
@ -115,7 +114,8 @@ void CreateServerScreen::onUpdate(float delta)
else
{
m_info_widget->setDefaultColor();
m_info_widget->setText(Online::Messages::creatingServer(), false);
m_info_widget->setText(StringUtils::loadingDots(_("Creating server")),
false);
}
}
} // onUpdate

View File

@ -21,7 +21,6 @@
#include "config/player_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/widgets.hpp"
#include "online/messages.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include "utils/string_utils.hpp"
@ -227,7 +226,8 @@ void ChangePasswordDialog::error(const irr::core::stringw & error)
void ChangePasswordDialog::onUpdate(float dt)
{
if(!m_options_widget->isActivated())
m_info_widget->setText(Online::Messages::validatingInfo(), false);
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
false );
// It's unsafe to delete from inside the event handler so we do it here
if (m_self_destroy)

View File

@ -20,7 +20,6 @@
#include "audio/sfx_manager.hpp"
#include "config/player_manager.hpp"
#include "guiengine/engine.hpp"
#include "online/messages.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include "utils/string_utils.hpp"
@ -200,7 +199,8 @@ void RecoveryDialog::onUpdate(float dt)
}
else
{
m_info_widget->setText(Messages::validatingInfo(), false);
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
false);
}
}
// It's unsafe to delete from inside the event handler so we do it here

View File

@ -24,7 +24,6 @@
#include "states_screens/register_screen.hpp"
#include "utils/translation.hpp"
#include "utils/string_utils.hpp"
#include "online/messages.hpp"
#include <IGUIEnvironment.h>

View File

@ -21,7 +21,6 @@
#include "guiengine/engine.hpp"
#include "network/protocol_manager.hpp"
#include "network/protocols/connect_to_server.hpp"
#include "online/messages.hpp"
#include "online/servers_manager.hpp"
#include "states_screens/dialogs/registration_dialog.hpp"
#include "states_screens/networking_lobby.hpp"
@ -152,7 +151,8 @@ void ServerInfoDialog::onUpdate(float dt)
else
{
m_info_widget->setDefaultColor();
m_info_widget->setText(Online::Messages::joiningServer(), false);
m_info_widget->setText(StringUtils::loadingDots(_("Joining server")),
false);
}
}

View File

@ -22,7 +22,6 @@
#include "guiengine/dialog_queue.hpp"
#include "guiengine/engine.hpp"
#include "online/online_profile.hpp"
#include "online/messages.hpp"
#include "states_screens/online_profile_friends.hpp"
#include "states_screens/online_profile_overview.hpp"
#include "states_screens/state_manager.hpp"
@ -453,7 +452,8 @@ bool UserInfoDialog::onEscapePressed()
void UserInfoDialog::onUpdate(float dt)
{
if(m_processing) m_info_widget->setText(Messages::processing(), false);
if(m_processing)
m_info_widget->setText(StringUtils::loadingDots(_("Processing")), false);
//If we want to open the registration dialog, we need to close this one first
if (m_enter_profile) m_self_destroy = true;

View File

@ -21,7 +21,6 @@
#include "audio/sfx_manager.hpp"
#include "config/player_manager.hpp"
#include "guiengine/engine.hpp"
#include "online/messages.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include "utils/string_utils.hpp"
@ -164,8 +163,8 @@ void VoteDialog::updateFetchVote()
if (!m_fetch_vote_request->isDone())
{
// request still pending
m_info_widget->setText(irr::core::stringw(_("Fetching last vote"))
+ Messages::loadingDots(), false);
m_info_widget->setText(StringUtils::loadingDots(_("Fetching last vote")),
false );
return;
} // !isDone
@ -236,8 +235,8 @@ void VoteDialog::onUpdate(float dt)
} // isDone
else
{
m_info_widget->setText(irr::core::stringw(_("Performing vote"))
+ Messages::loadingDots(), false);
m_info_widget->setText(StringUtils::loadingDots(_("Performing vote")),
false);
} // !isDone
}

View File

@ -24,7 +24,6 @@
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "online/messages.hpp"
#include "online/online_profile.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
#include "states_screens/state_manager.hpp"
@ -122,7 +121,7 @@ void OnlineProfileAchievements::init()
m_visiting_profile->fetchAchievements();
m_achievements_list_widget->clear();
m_achievements_list_widget->addItem("loading",
Messages::fetchingAchievements());
StringUtils::loadingDots(_("Fetching achievements")));
}
} // init
@ -161,8 +160,8 @@ void OnlineProfileAchievements::onUpdate(float delta)
if (!m_visiting_profile->isReady())
{
// This will display an increasing number of dots while waiting.
m_achievements_list_widget->renameItem("loading",
Messages::fetchingAchievements());
m_achievements_list_widget->renameItem("loading",
StringUtils::loadingDots(_("Fetching achievements")));
return;
}

View File

@ -21,7 +21,6 @@
#include "guiengine/scalable_font.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "online/messages.hpp"
#include "states_screens/dialogs/user_info_dialog.hpp"
#include "states_screens/online_user_search.hpp"
#include "states_screens/state_manager.hpp"
@ -85,7 +84,8 @@ void OnlineProfileFriends::init()
m_visiting_profile->fetchFriends();
m_waiting_for_friends = true;
m_friends_list_widget->clear();
m_friends_list_widget->addItem("loading", Messages::fetchingFriends());
m_friends_list_widget->addItem("loading",
StringUtils::loadingDots(_("Fetching friends")));
} // init
// -----------------------------------------------------------------------------
@ -171,7 +171,7 @@ void OnlineProfileFriends::onUpdate(float delta)
else
{
m_friends_list_widget->renameItem("loading",
Messages::fetchingFriends());
StringUtils::loadingDots(_("Fetching friends")));
}
}
} // onUpdate

View File

@ -32,7 +32,6 @@
#include "network/protocol_manager.hpp"
#include "network/protocols/connect_to_server.hpp"
#include "network/protocols/request_connection.hpp"
#include "online/messages.hpp"
#include "online/profile_manager.hpp"
#include "online/request.hpp"
#include "online/servers_manager.hpp"
@ -153,11 +152,13 @@ void OnlineScreen::onUpdate(float delta)
if (m_recorded_state == PlayerProfile::OS_SIGNING_IN)
{
m_online_status_widget->setText(Messages::signingIn(), false);
m_online_status_widget->setText(StringUtils::loadingDots(_("Signing in")),
false );
}
else if (m_recorded_state == PlayerProfile::OS_SIGNING_OUT)
{
m_online_status_widget->setText(Messages::signingOut(), false);
m_online_status_widget->setText(StringUtils::loadingDots(_("Signing out")),
false );
}
} // onUpdate

View File

@ -20,7 +20,6 @@
#include "audio/sfx_manager.hpp"
#include "config/player_manager.hpp"
#include "guiengine/modaldialog.hpp"
#include "online/messages.hpp"
#include "online/profile_manager.hpp"
#include "states_screens/dialogs/user_info_dialog.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
@ -199,7 +198,7 @@ void OnlineUserSearch::search()
m_user_list_widget->clear();
m_user_list_widget->addItem("spacer", L"");
m_user_list_widget->addItem("loading", Messages::searching());
m_user_list_widget->addItem("loading", StringUtils::loadingDots(_("Searching")));
m_back_widget->setDeactivated();
m_search_box_widget->setDeactivated();
m_search_button_widget->setDeactivated();
@ -276,7 +275,8 @@ void OnlineUserSearch::onUpdate(float dt)
}
else
{
m_user_list_widget->renameItem("loading", Messages::searching());
m_user_list_widget->renameItem("loading",
StringUtils::loadingDots(_("Searching")) );
}
}
} // onUpdate

View File

@ -24,7 +24,6 @@
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/ribbon_widget.hpp"
#include "guiengine/widgets/text_box_widget.hpp"
#include "online/messages.hpp"
#include "online/xml_request.hpp"
#include "states_screens/dialogs/registration_dialog.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
@ -286,7 +285,8 @@ void RegisterScreen::onUpdate(float dt)
if(m_signup_request)
{
if(!m_options_widget->isActivated())
m_info_widget->setText(Messages::validatingInfo(), false);
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
false);
if(m_signup_request->isDone())
{

View File

@ -26,7 +26,6 @@
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
#include "utils/string_utils.hpp"
#include "online/messages.hpp"
#include "audio/sfx_manager.hpp"
using namespace Online;
@ -64,7 +63,8 @@ void ServerSelection::refresh()
m_fake_refresh = (m_refresh_request == NULL ? true : false);
m_server_list_widget->clear();
m_server_list_widget->addItem("spacer", L"");
m_server_list_widget->addItem("loading", Messages::fetchingServers());
m_server_list_widget->addItem("loading",
StringUtils::loadingDots(_("Fetching servers")));
m_reload_widget->setDeactivated();
}
@ -206,7 +206,8 @@ void ServerSelection::onUpdate(float dt)
}
else
{
m_server_list_widget->renameItem("loading", Messages::fetchingServers());
m_server_list_widget->renameItem("loading",
StringUtils::loadingDots(_("Fetching servers")));
}
}
else if(m_fake_refresh)

View File

@ -26,7 +26,6 @@
#include "guiengine/widgets/label_widget.hpp"
#include "guiengine/widgets/list_widget.hpp"
#include "guiengine/widgets/text_box_widget.hpp"
#include "online/messages.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/options_screen_audio.hpp"
@ -395,8 +394,8 @@ void BaseUserScreen::onUpdate(float dt)
core::stringw message = (m_state & STATE_LOGOUT)
? _(L"Signing out '%s'",m_sign_out_name.c_str())
: _(L"Signing in '%s'", m_sign_in_name.c_str());
m_info_widget->setText(Online::Messages::loadingDots(message.c_str()),
false );
m_info_widget->setText(StringUtils::loadingDots(message.c_str()),
false );
}
PlayerProfile *player = getSelectedPlayer();
if(player)

View File

@ -21,6 +21,7 @@
#include "utils/string_utils.hpp"
#include "utils/log.hpp"
#include "utils/time.hpp"
#include "coreutil.h"
@ -523,6 +524,29 @@ namespace StringUtils
return std::string(s);
} // timeToString
// ------------------------------------------------------------------------
/** Shows a increasing number of dots.
* \param interval A float representing the time it takes to add a new dot
* \param max_dots The number of dots used. Defaults to 3.
*/
irr::core::stringw loadingDots(float interval, int max_dots)
{
int nr_dots = int(floor(StkTime::getRealTime() / interval))
% (max_dots + 1);
return irr::core::stringw((std::string(nr_dots, '.') +
std::string(max_dots - nr_dots, ' ')).c_str());
} // loadingDots
// ------------------------------------------------------------------------
/** Returns the string given with loadingDots appended. A simple
* convenience function to type less in calls.
* \parameter s The string to which the loading dots are appended.
*/
irr::core::stringw loadingDots(const wchar_t *s)
{
return irr::core::stringw(s) + loadingDots();
} // loadingDots
// ------------------------------------------------------------------------
/** Replaces values in a string.
* \param other string in which to replace stuff

View File

@ -46,6 +46,8 @@ namespace StringUtils
bool notEmpty(const irr::core::stringw& input);
std::string timeToString(float time);
irr::core::stringw loadingDots(float interval = 0.5f, int max_dots = 3);
irr::core::stringw loadingDots(const wchar_t *s);
std::string toUpperCase(const std::string&);
std::string toLowerCase(const std::string&);
std::vector<std::string> split(const std::string& s, char c,

View File

@ -14,10 +14,10 @@ if(FONT_TOOL)
if(FREETYPE_FOUND)
include_directories(${FREETYPE_INCLUDE_DIRS})
add_executable(font_tool CFontTool.cpp main.cpp)
target_link_libraries(font_tool stkirrlicht)
target_link_libraries(font_tool ${FREETYPE_LIBRARIES})
target_link_libraries(font_tool ${X11_Xft_LIB} Xxf86vm)
target_link_libraries(font_tool ${OPENGL_LIBRARIES})
target_link_libraries(font_tool stkirrlicht)
target_link_libraries(font_tool ${FONTCONFIG_LIBRARY})
else()
message(STATUS "Freetype was not found, the font tool won't be built (only useful for developers)")