Network stuff and Utils Engine
This commit is contained in:
parent
9627247bdc
commit
06652bfa0d
@ -41,7 +41,7 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;$(LibsPath)\DirectXsdk\Include;$(LibsPath)\lpng1510</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>UTILS_ENGINE;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -54,7 +54,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;$(LibsPath)\DirectXsdk\Include;$(LibsPath)\lpng1510</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>UTILS_ENGINE;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -75,6 +75,7 @@
|
||||
<ClCompile Include="..\src\Utils\WinApi\WinApi.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\Engine.h" />
|
||||
<ClInclude Include="..\include\Utils\BindableVar.h" />
|
||||
<ClInclude Include="..\include\Utils\Console\console.h" />
|
||||
<ClInclude Include="..\include\Utils\DataTypes\DataTypes.h" />
|
||||
|
@ -1,6 +1,14 @@
|
||||
#ifndef ENGINE_H_INCLUDED
|
||||
#define ENGINE_H_INCLUDED
|
||||
|
||||
|
||||
#ifdef UTILS_ENGINE
|
||||
|
||||
#include "include/Utils/Utils.h"
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#ifdef TARGET_WIN32
|
||||
#include "SalmonEngineWindows.h"
|
||||
#endif
|
||||
@ -13,4 +21,6 @@
|
||||
#include "include/SalmonEngineIos.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif //ENGINE_H_INCLUDED
|
@ -60,7 +60,9 @@ public:
|
||||
|
||||
virtual std::string GetHistory();
|
||||
|
||||
#ifndef UTILS_ENGINE
|
||||
virtual void Draw();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -81,6 +81,7 @@ public:
|
||||
|
||||
typedef boost::variant<std::shared_ptr<TSimpleAuthorization>> TAuthorizationVariant;
|
||||
|
||||
|
||||
class TClientSocket : public boost::enable_shared_from_this<TClientSocket>
|
||||
{
|
||||
protected:
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
namespace SE
|
||||
{
|
||||
|
||||
#ifndef UTILS_ENGINE
|
||||
struct TFuncToPerform
|
||||
{
|
||||
private:
|
||||
@ -34,6 +34,8 @@ namespace SE
|
||||
template<typename RETURNTYPE>
|
||||
RETURNTYPE PerformInMainThread(boost::function<RETURNTYPE()> f);
|
||||
|
||||
#endif
|
||||
|
||||
} //namespace SE
|
||||
|
||||
#endif
|
@ -12,6 +12,8 @@ const int CONST_ROW_WIDTH = 14;
|
||||
|
||||
const std::string CONST_CONSOLE_TEX_NAME = "console_bkg.bmp";
|
||||
|
||||
#ifndef UTILS_ENGINE
|
||||
|
||||
void TSimpleConsole::Draw()
|
||||
{
|
||||
|
||||
@ -59,6 +61,7 @@ void TSimpleConsole::Draw()
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void TSimpleConsole::CutHistory()
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ TSimpleAuthorization::TSimpleAuthorization(boost::asio::io_service& ioService, b
|
||||
|
||||
void TSimpleAuthorization::Authorize()
|
||||
{
|
||||
std::shared_ptr<TDataReader> dataReader(new TDataReader(Socket));
|
||||
boost::shared_ptr<TDataReader> dataReader(new TDataReader(Socket));
|
||||
|
||||
dataReader->DataReadSignal.connect(boost::bind(&TSimpleAuthorization::HandleGetData, this, _1));
|
||||
|
||||
@ -115,8 +115,8 @@ void TSimpleAuthorization::HandleGetData(boost::property_tree::ptree pTree)
|
||||
{
|
||||
if (pTree.find("OnHello") != pTree.not_found())
|
||||
{
|
||||
Login = p.get<std::string>("OnHello.Login");
|
||||
Password = p.get<std::string>("OnHello.Password");
|
||||
Login = pTree.get<std::string>("OnHello.Login");
|
||||
Password = pTree.get<std::string>("OnHello.Password");
|
||||
|
||||
SaveLoginPasswordSignal(Login, Password);
|
||||
AuthorizedSignal();
|
||||
@ -172,7 +172,7 @@ void TClientSocket::Open(const std::string address, const std::string& port)
|
||||
return;
|
||||
}
|
||||
|
||||
boost::asio::async_connect(Socket, iterator, boost::bind(&TClientSocket::HandleConnect, shared_from_this(), boost::asio::placeholders::error));
|
||||
boost::asio::async_connect(Socket, iterator, boost::bind(&TClientSocket::HandleConnect, this, boost::asio::placeholders::error));
|
||||
|
||||
ConnectionTimeoutTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::seconds(CONST_CONNECTION_TIMEOUT_SECONDS)));
|
||||
|
||||
|
@ -53,7 +53,11 @@ boost::property_tree::ptree::iterator ReplaceIncludeFile(boost::property_tree::p
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UTILS_ENGINE
|
||||
xmlFileArr = CreateMemFromFile<char>(fileName, xmlFileSize);
|
||||
#else
|
||||
xmlFileArr = CreateMemFromFile<char>(ResourceManager->PathToResources + fileName, xmlFileSize);
|
||||
#endif
|
||||
|
||||
std::string xmlString = std::string(&xmlFileArr[0], &xmlFileArr[xmlFileSize]);
|
||||
|
||||
@ -143,7 +147,11 @@ std::shared_ptr<boost::property_tree::ptree> FileToPropertyTree(const std::strin
|
||||
{
|
||||
cardinal byteCount;
|
||||
|
||||
#ifdef UTILS_ENGINE
|
||||
boost::shared_array<char> file = CreateMemFromFile<char>(fileName, byteCount);
|
||||
#else
|
||||
boost::shared_array<char> file = CreateMemFromFile<char>(ResourceManager->PathToResources + fileName, byteCount);
|
||||
#endif
|
||||
|
||||
return FileToPropertyTree(file, byteCount, replaceMap);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace SE
|
||||
{
|
||||
|
||||
#ifndef UTILS_ENGINE
|
||||
void AssertIfInMainThread()
|
||||
{
|
||||
if (boost::this_thread::get_id() != ResourceManager->MainThreadId)
|
||||
@ -30,5 +31,6 @@ namespace SE
|
||||
ResourceManager->MainThreadAsyncFunctionArr.push_back(f);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} //namespace SE
|
@ -8,27 +8,27 @@ Here goes all functions that are platform-specific
|
||||
When I make iOS/Mac/Linux port, I will make same API pair h/cpp
|
||||
*/
|
||||
|
||||
void GetWindowWidthHeight(int& width, int& height)
|
||||
void GetWindowWidthHeight(HWND hwnd, int& width, int& height)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(Hwnd, &rc);
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
width = rc.right;
|
||||
height = rc.bottom;
|
||||
}
|
||||
|
||||
int GetWindowWidth()
|
||||
int GetWindowWidth(HWND hwnd)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(Hwnd, &rc);
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
return rc.right;
|
||||
}
|
||||
|
||||
int GetWindowHeight()
|
||||
int GetWindowHeight(HWND hwnd)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(Hwnd, &rc);
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
return rc.bottom;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user