53 #include "gui/viewport.h"
120 #include "resources/map/map.h"
129 #include "utils/perfstat.h"
132 #include "utils/timer.h"
134 #ifdef __native_client__
150 #include <sys/time.h>
246 "ItemShortcut",
"items.xml", 83, 460);
411 mAdjustPerfomance(
config.getBoolValue(
"adjustPerfomance")),
421 logger->
log(
"error: double game creation");
478 "disableLoggingInGame");
564 const std::string &prefix)
567 if (
mkdir_r(screenshotDirectory.c_str()) != 0)
569 logger->
log(
"Directory %s doesn't exist and can't be created! "
570 "Setting screenshot directory to home.",
571 screenshotDirectory.c_str());
576 std::stringstream filename;
577 std::fstream testExists;
582 tm *
const timeinfo = localtime(&rawtime);
583 strftime(buffer, 99,
"%Y-%m-%d_%H-%M-%S", timeinfo);
586 std::string screenShortStr;
589 if (serverName.empty())
591 screenShortStr =
strprintf(
"%s_Screenshot_%s_",
597 screenShortStr =
strprintf(
"%s_Screenshot_%s_%s_",
599 serverName.c_str(), buffer);
603 static unsigned int screenshotCount = 0;
608 filename << screenshotDirectory <<
"/";
609 filename << screenShortStr << screenshotCount <<
".png";
610 testExists.open(filename.str().c_str(), std::ios::in);
611 found = !testExists.is_open();
618 screenShortStr = prefix;
620 filename << screenshotDirectory <<
"/";
621 filename << screenShortStr;
624 const std::string fileNameStr = filename.str();
626 #ifdef __native_client__
627 std::string nacScreenshotlDir = fileNameStr;
628 cutFirst(nacScreenshotlDir,
"/persistent");
629 naclPostMessage(
"copy-from-persistent", nacScreenshotlDir);
630 logger->
log(
"nacl screenshot path: " + nacScreenshotlDir);
638 std::string str =
strprintf(
_(
"Screenshot saved as %s"),
639 fileNameStr.c_str());
656 logger->
log1(
"Error: could not save screenshot.");
808 else if (maxFps < 10)
811 if (
fps < maxFps - 10)
833 _(
"Auto disable Show beings transparency"),
854 _(
"Auto lower Particle effects"),
875 _(
"Auto enable opacity cache"),
905 "particleEmitterSkip") + 1;
912 "particleEmitterSkip") + 1;
938 if (dialog !=
nullptr)
954 unsigned char direction = 0;
1129 realFullMap.append(
".gz");
1137 if (newMap !=
nullptr)
1154 if (newMap !=
nullptr)
1158 const std::string oldMusic =
mCurrentMap !=
nullptr
1160 const std::string newMusic = newMap !=
nullptr ?
1162 if (newMusic != oldMusic)
1164 if (newMusic.empty())
1181 mumbleManager->setMap(mapPath);
1197 if (
CAST_S32(event.key.keysym.sym) != -1)
1207 if (lastKey.
key == key)
1251 const int timeRange = 120;
1252 const int cntInTime = 130;
1263 if (lastKey.
time + timeRange < time)
1265 if (lastKey.
cnt > cntInTime)
ActorManager * actorManager
AssertListener * assertListener
BattleTab * battleChatTab
BeingSlot * emptyBeingSlot
void setPlayer(LocalPlayer *const player)
void setMap(Map *const map)
static void setEnableCache(const bool b)
const StringVect & getMessages() const
virtual void add(Widget *const widget)
uint8_t getDirection() const
static void reReadConfig()
void recreateItemParticles()
void setAllowHighlight(const bool n)
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
void loadFromLogFile(const std::string &name)
bool isInputFocused() const
ChatTab * addSpecialChannelTab(const std::string &name, const bool switchTo)
static void setEnableDelay(bool b)
std::string getValue(const std::string &key, const std::string &deflt) const
bool getBoolValue(const std::string &key) const
void setValue(const std::string &key, const std::string &value)
void incValue(const std::string &key)
void setSilent(const std::string &key, const std::string &value)
int getIntValue(const std::string &key) const
static void delayedLoad()
static Window * openErrorDialog(const std::string &header, const std::string &message, const Modal modal)
static void closeDialogs()
void setVisible(Visible visible)
void handleGameEvents() const
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
void updateFrameRate(int fpsLimit)
LastKey mLastKeys[MAX_LASTKEYS]
static void addWatermark()
static bool saveScreenshot(SDL_Surface *const screenshot, const std::string &prefix)
void updateHistory(const SDL_Event &event)
static void moveInDirection(const unsigned char direction)
static bool createScreenshot(const std::string &prefix)
void changeMap(const std::string &mapName)
static void videoResized(const int width, const int height)
RenderType getOpenGL() const
void setSecure(const bool n)
static bool getEnableGuildBot()
static bool isAnyInputFocused()
static InputActionT getKeyIndex(const SDL_Event &event, const int grp)
void setMap(Map *const map)
void specialMove(const unsigned char direction)
void updateStatus() const
void log(const char *const log_text,...)
void log1(const char *const log_text)
static void unloadEmptyAtlas()
static Map * readMap(const std::string &filename, const std::string &realFilename)
static void loadEmptyAtlas()
void saveExtraLayer() const
void update(const int ticks)
void initializeParticleEffects() const
const std::string getMusicFile() const
void setMap(const Map *const map)
virtual void initEngines() const =0
virtual void ping(const int tick) const =0
virtual bool isConnected() const =0
virtual void mapLoadedEvent() const =0
virtual bool mustPing() const =0
virtual void gameStarted() const =0
virtual void gameEnded() const =0
static NpcDialog * getActive()
void setMap(Map *const map)
static void setupEngine()
void setMap(const Map *const map)
virtual SDL_Surface * getScreenshot()=0
bool disableLoggingInGame
KeyboardFocusT inputFocused
std::string screenshotDir
void clearWindowsForReset()
void setInGame(const bool inGame)
void addTab(const std::string &name, ShortcutContainer *const content)
void setMap(Map *const map)
void fadeOutAndPlayMusic(const std::string &fileName, const int ms)
void fadeOutMusic(const int ms)
const Color & getColor(const ThemeColorIdT type, const unsigned int alpha)
void setInGame(const bool b)
static void distributeEvent()
void moveCamera(const int dx, const int dy)
void setMap(Map *const map)
void setAllowUpdate(const bool n)
virtual void setVisible(Visible visible)
bool isWindowVisible() const
virtual void scheduleDelete()
Configuration serverConfig
const std::string GENERAL_CHANNEL
const std::string TRADE_CHANNEL
const unsigned int SHORTCUT_TABS
CutInWindow * cutInWindow
#define MSDL_FreeSurface(surface)
DebugWindow * debugWindow
DidYouKnowWindow * didYouKnowWindow
DropShortcut * dropShortcut
EffectManager * effectManager
EmoteShortcut * emoteShortcut
EmoteWindow * emoteWindow
EquipmentWindow * equipmentWindow
EquipmentWindow * beingEquipmentWindow
ErrorListener errorListener
EventsManager eventsManager
#define FOR_EACH(type, iter, array)
static void destroyGuiWindows()
static void initEngines()
static void createGuiWindows()
Window * disconnectedDialog
static const int MAX_LASTKEYS
Net::GameHandler * gameHandler
Net::GeneralHandler * generalHandler
const Image *restrict const top
ScreenshotHelper * screenshortHelper
GuildManager * guildManager
const bool IgnoreRecord_false
InventoryWindow * inventoryWindow
InventoryWindow * cartWindow
LocalPlayer * localPlayer
MiniStatusWindow * miniStatusWindow
int mkdir_r(const char *const pathname)
Create a directory, making leading components first if necessary.
bool screenshot(InputEvent &event)
std::string toString(T const &value)
converts any type to a string
const std::string getMapName(const std::string &name)
ServerTypeT getNetworkType()
Inventory * getInventory()
Equipment * getEquipment()
Inventory * getCartInventory()
bool writePNG(SDL_Surface *const surface, const std::string &filename)
const char * getUserDir()
bool exists(std::string name)
void setFramerate(const unsigned int fpsLimit)
OutfitWindow * outfitWindow
ParticleEngine * particleEngine
#define FUNC_BLOCK(name, id)
#define BLOCK_START(name)
QuestsWindow * questsWindow
SetupWindow * setupWindow
ShortcutWindow * dropShortcutWindow
ShortcutWindow * spellShortcutWindow
ShortcutWindow * emoteShortcutWindow
ShortcutWindow * itemShortcutWindow
SkillDialog * skillDialog
SocialWindow * socialWindow
SoundManager soundManager
const unsigned int SPELL_SHORTCUT_TABS
StatusWindow * statusWindow
void cutFirst(std::string &str1, const std::string &str2)
std::string strprintf(const char *const format,...)
std::string pathJoin(std::string str1, const std::string &str2)
StringVect::const_iterator StringVectCIter
std::vector< std::string > StringVect
int get_elapsed_time1(const int startTime)
TouchManager touchManager
TradeWindow * tradeWindow
const bool TryRemoveColors_true
WhoIsOnline * whoIsOnline
WindowContainer * windowContainer