back to otclient dev, with new background!
* show otclient version in background * disable about module (don't really need it) * new function for formating strings like sprintf, Fw::formatString * new nice background (taken from RPG maker XV) * update contact information in README * fix text rendering issues with opacity
This commit is contained in:
parent
b46d4c4d5f
commit
a24212d4de
|
@ -29,6 +29,11 @@ http://otclient.info/tracker
|
|||
We encourage you to contribute to OTClient! Please check out
|
||||
{our website}[http://otclient.info/] for guidelines about how to proceed. Join us!
|
||||
|
||||
== Contact
|
||||
|
||||
You have 3 options, post at http://otclient.info/ , talk directly with us at #otclient irc.freenode.net or send
|
||||
an email directly to the project leader edub4rt@gmail.com
|
||||
|
||||
== Authors
|
||||
|
||||
* edubart (project creator and leader developer) <edub4rt@gmail.com>
|
||||
|
@ -37,5 +42,5 @@ We encourage you to contribute to OTClient! Please check out
|
|||
|
||||
== License
|
||||
|
||||
OTClient is made available under the MIT License
|
||||
OTClient is made available under the MIT License, thus this means that you can do whatever you want, commercial, non-commercial, closed or open.
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ Module
|
|||
load-later:
|
||||
- client_topmenu
|
||||
- client_background
|
||||
- client_about
|
||||
//- client_about
|
||||
- client_options
|
||||
- client_terminal
|
||||
- client_modulemanager
|
||||
|
|
|
@ -8,6 +8,11 @@ function Background.init()
|
|||
background = displayUI('background.otui')
|
||||
background:lower()
|
||||
|
||||
local clientVersionLabel = background:getChildById('clientVersionLabel')
|
||||
clientVersionLabel:setText('OTClient ' .. g_app.getVersion() .. '\n' ..
|
||||
'Built on ' .. g_app.getBuildDate())
|
||||
Effects.fadeIn(clientVersionLabel, 1500)
|
||||
|
||||
connect(g_game, { onGameStart = Background.hide })
|
||||
connect(g_game, { onGameEnd = Background.show })
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Panel
|
||||
id: background
|
||||
image-source: /client_background/background.png
|
||||
image-source: /client_background/bg.png
|
||||
image-smooth: true
|
||||
image-fixed-ratio: true
|
||||
anchors.top: topMenu.bottom
|
||||
|
@ -9,3 +9,14 @@ Panel
|
|||
anchors.bottom: parent.bottom
|
||||
margin-top: 1
|
||||
focusable: false
|
||||
|
||||
UILabel
|
||||
background-color: #00000099
|
||||
id: clientVersionLabel
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
text-offset: 4 2
|
||||
height: 32
|
||||
width: 120
|
||||
color: #ffffff
|
||||
font: verdana-11px-monochrome
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
@ -80,6 +80,7 @@ function EnterGame.init()
|
|||
enterGame:getChildById('accountNameLineEdit'):focus()
|
||||
|
||||
-- only open entergame when app starts
|
||||
enterGame:hide()
|
||||
if not g_app.isRunning() then
|
||||
if #account > 0 and autologin then
|
||||
addEvent(EnterGame.doLogin)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
Label < UILabel
|
||||
font: verdana-11px-antialised
|
||||
color: #aaaaaa
|
||||
color: #bbbbbb
|
||||
|
||||
$disabled:
|
||||
color: #aaaaaa88
|
||||
color: #bbbbbb88
|
||||
|
||||
GameLabel < UILabel
|
||||
font: verdana-11px-antialised
|
||||
color: #aaaaaa
|
||||
color: #bbbbbb
|
||||
|
||||
FrameCounter < UIFrameCounter
|
||||
size: 68 16
|
||||
|
|
|
@ -67,7 +67,7 @@ Application::~Application()
|
|||
void Application::init(const std::vector<std::string>& args, int appFlags)
|
||||
{
|
||||
m_appFlags = appFlags;
|
||||
logInfo("Starting application...");
|
||||
logInfo("Starting ", m_appName, " ", m_appVersion);
|
||||
|
||||
// capture exit signals
|
||||
signal(SIGTERM, exitSignalHandler);
|
||||
|
|
|
@ -47,7 +47,9 @@ public:
|
|||
|
||||
bool isRunning() { return m_running; }
|
||||
bool isStopping() { return m_stopping; }
|
||||
const std::string& getAppName() { return m_appName; }
|
||||
const std::string& getName() { return m_appName; }
|
||||
const std::string& getVersion() { return m_appVersion; }
|
||||
const std::string& getBuildDate() { return m_appBuildDate; }
|
||||
|
||||
protected:
|
||||
virtual void render();
|
||||
|
@ -55,6 +57,8 @@ protected:
|
|||
virtual void inputEvent(const InputEvent& event);
|
||||
|
||||
std::string m_appName;
|
||||
std::string m_appVersion;
|
||||
std::string m_appBuildDate;
|
||||
int m_appFlags;
|
||||
int m_pollCycleDelay;
|
||||
Boolean<false> m_running;
|
||||
|
|
|
@ -64,7 +64,7 @@ void ModuleManager::discoverModulesPath()
|
|||
std::string possibleModulesDirs[] = { "modules",
|
||||
g_resources.getBaseDir() + "modules",
|
||||
g_resources.getBaseDir() + "../modules",
|
||||
g_resources.getBaseDir() + "../share/" + g_app->getAppName() + "/modules",
|
||||
g_resources.getBaseDir() + "../share/" + g_app->getName() + "/modules",
|
||||
"" };
|
||||
bool found = false;
|
||||
for(const std::string& dir : possibleModulesDirs) {
|
||||
|
@ -83,7 +83,7 @@ void ModuleManager::discoverModulesPath()
|
|||
std::string possibleAddonsDirs[] = { "addons",
|
||||
g_resources.getBaseDir() + "addons",
|
||||
g_resources.getBaseDir() + "../addons",
|
||||
g_resources.getBaseDir() + "../addons/" + g_app->getAppName() + "/modules",
|
||||
g_resources.getBaseDir() + "../addons/" + g_app->getName() + "/modules",
|
||||
"" };
|
||||
for(const std::string& dir : possibleAddonsDirs) {
|
||||
// try to add module directory
|
||||
|
|
|
@ -418,6 +418,9 @@ void Application::registerLuaFunctions()
|
|||
g_lua.bindClassStaticFunction("g_app", "exit", std::bind(&Application::exit, g_app));
|
||||
g_lua.bindClassStaticFunction("g_app", "isRunning", std::bind(&Application::isRunning, g_app));
|
||||
g_lua.bindClassStaticFunction("g_app", "isStopping", std::bind(&Application::isStopping, g_app));
|
||||
g_lua.bindClassStaticFunction("g_app", "getName", std::bind(&Application::getName, g_app));
|
||||
g_lua.bindClassStaticFunction("g_app", "getVersion", std::bind(&Application::getVersion, g_app));
|
||||
g_lua.bindClassStaticFunction("g_app", "getBuildDate", std::bind(&Application::getBuildDate, g_app));
|
||||
|
||||
// ConfigManager
|
||||
g_lua.registerStaticClass("g_configs");
|
||||
|
|
|
@ -41,7 +41,7 @@ void crashHandler(int signum, siginfo_t* info, void* secret)
|
|||
char fileName[128];
|
||||
time(&tnow);
|
||||
tm *ts = localtime(&tnow);
|
||||
strftime(fileName, 128, (g_app->getAppName() + "-crash_-%d-%m-%Y_%H:%M:%S.txt").c_str(), ts);
|
||||
strftime(fileName, 128, (g_app->getName() + "-crash_-%d-%m-%Y_%H:%M:%S.txt").c_str(), ts);
|
||||
|
||||
std::stringstream ss;
|
||||
ss.flags(std::ios::hex | std::ios::showbase);
|
||||
|
|
|
@ -46,7 +46,7 @@ LONG WINAPI crashHandler(EXCEPTION_POINTERS* exceptionPointers)
|
|||
|
||||
SYSTEMTIME systemTime;
|
||||
GetSystemTime(&systemTime);
|
||||
snprintf(fileName, 128, "%s_%02u-%02u-%04u_%02u-%02u-%02u.mdmp", g_app->getAppName().c_str(),
|
||||
snprintf(fileName, 128, "%s_%02u-%02u-%04u_%02u-%02u-%02u.mdmp", g_app->getName().c_str(),
|
||||
systemTime.wDay, systemTime.wMonth, systemTime.wYear,
|
||||
systemTime.wHour, systemTime.wMinute, systemTime.wSecond);
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ void WIN32Window::terminate()
|
|||
}
|
||||
|
||||
if(m_instance) {
|
||||
if(!UnregisterClassA(g_app->getAppName().c_str(), m_instance))
|
||||
if(!UnregisterClassA(g_app->getName().c_str(), m_instance))
|
||||
logError("UnregisterClassA failed");
|
||||
m_instance = NULL;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ void WIN32Window::internalRegisterWindowClass()
|
|||
wc.hCursor = m_defaultCursor;
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = g_app->getAppName().c_str();
|
||||
wc.lpszClassName = g_app->getName().c_str();
|
||||
|
||||
if(!RegisterClassA(&wc))
|
||||
logFatal("Failed to register the window class.");
|
||||
|
@ -272,7 +272,7 @@ void WIN32Window::internalCreateWindow()
|
|||
|
||||
updateUnmaximizedCoords();
|
||||
m_window = CreateWindowExA(dwExStyle,
|
||||
g_app->getAppName().c_str(),
|
||||
g_app->getName().c_str(),
|
||||
NULL,
|
||||
dwStyle,
|
||||
windowRect.left,
|
||||
|
|
|
@ -41,7 +41,7 @@ void UIFrameCounter::draw()
|
|||
UIWidget::draw();
|
||||
|
||||
if(g_clock.ticksElapsed(m_lastFrameTicks) >= 1000) {
|
||||
m_fpsText = Fw::mkstr("FPS: ", m_frameCount);
|
||||
m_fpsText = Fw::formatString("FPS: %d", m_frameCount);
|
||||
m_lastFrameTicks = g_clock.ticks();
|
||||
m_frameCount = 0;
|
||||
}
|
||||
|
|
|
@ -61,9 +61,10 @@ void UIWidget::drawText(const Rect& screenCoords)
|
|||
m_textFramebuffer->bind();
|
||||
Rect virtualTextRect(0, 0, boxSize);
|
||||
virtualTextRect.translate(m_textOffset);
|
||||
g_painter.saveAndResetState();
|
||||
g_painter.setCompositionMode(Painter::CompositionMode_DestBlending);
|
||||
m_font->renderText(m_text, virtualTextRect, m_textAlign, Fw::white);
|
||||
g_painter.resetCompositionMode();
|
||||
g_painter.restoreSavedState();
|
||||
m_textFramebuffer->release();
|
||||
|
||||
m_textMustRecache = false;
|
||||
|
|
|
@ -113,6 +113,23 @@ void println(const T&... args) {
|
|||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
// useful std::string version of sprintf :)
|
||||
template<typename... Args>
|
||||
std::string formatString(const std::string& format, Args... args) {
|
||||
int n, size = 1024;
|
||||
std::string str;
|
||||
while(true) {
|
||||
str.resize(size);
|
||||
n = snprintf(&str[0], size, format.c_str(), args...);
|
||||
assert(n != -1);
|
||||
if(n < size) {
|
||||
str.resize(n);
|
||||
return str;
|
||||
}
|
||||
size *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
// demangle names for GNU g++ compiler
|
||||
inline std::string demangleName(const char* name) {
|
||||
size_t len;
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Otc
|
|||
constexpr const char* AppName = "OTClient";
|
||||
constexpr const char* AppCompactName = "otclient";
|
||||
constexpr const char* AppVersion = "0.4.0";
|
||||
constexpr const char* AppBuild = "_dev";
|
||||
|
||||
enum {
|
||||
TILE_PIXELS = 32,
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
#include <framework/core/resourcemanager.h>
|
||||
#include "core/map.h"
|
||||
|
||||
OTClient::OTClient(const std::string& appName) : Application(appName)
|
||||
OTClient::OTClient() : Application(Otc::AppCompactName)
|
||||
{
|
||||
|
||||
m_appVersion = Fw::formatString("%s%s", Otc::AppVersion, Otc::AppBuild);
|
||||
m_appBuildDate = __DATE__;
|
||||
}
|
||||
|
||||
void OTClient::init(const std::vector<std::string>& args)
|
||||
{
|
||||
logInfo(Otc::AppName, " ", Otc::AppVersion);
|
||||
Application::init(args, Fw::AppEnableAll);
|
||||
|
||||
g_modules.discoverModules();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class OTClient : public Application
|
||||
{
|
||||
public:
|
||||
OTClient(const std::string &appName = Otc::AppCompactName);
|
||||
OTClient();
|
||||
void init(const std::vector<std::string>& args);
|
||||
void registerLuaFunctions();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue