Fix toasts

This commit is contained in:
momo5502 2016-06-27 17:54:04 +02:00
parent 123d62e1eb
commit 967cfff5ec
5 changed files with 20 additions and 21 deletions

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 5a19135c356ed82a3508cd2c1399f532253ecc46 Subproject commit 79325bd219ae6fea7809324c38824269c2774fd1

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit 0ab78e19eb56fb992105eba034f3b63fd67b4ae5 Subproject commit 2bcd43afe4b649c95d932daf31b0b83948f7cf7c

View File

@ -86,34 +86,29 @@ namespace Components
bWidth += (bWidth % 2); bWidth += (bWidth % 2);
bHeight += (bHeight % 2); bHeight += (bHeight % 2);
#pragma warning(push)
#pragma warning(disable: 4244)
// Corners // Corners
Game::R_AddCmdDrawStretchPic(width / 2 - bWidth / 2, height - bHeight / 2, cornerSize, cornerSize, 0, 0, 0.5f, 0.5f, color, circle); // Top-Left Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 - bWidth / 2), static_cast<float>(height - bHeight / 2), cornerSize * 1.0f, cornerSize * 1.0f, 0, 0, 0.5f, 0.5f, color, circle); // Top-Left
Game::R_AddCmdDrawStretchPic(width / 2 + bWidth / 2 - cornerSize, height - bHeight / 2, cornerSize, cornerSize, 0.5f, 0, 0, 0.5f, color, circle); // Top-Right Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 + bWidth / 2 - cornerSize), static_cast<float>(height - bHeight / 2), cornerSize * 1.0f, cornerSize * 1.0f, 0.5f, 0, 0, 0.5f, color, circle); // Top-Right
Game::R_AddCmdDrawStretchPic(width / 2 - bWidth / 2, height + bHeight / 2 - cornerSize, cornerSize, cornerSize, 0, 0.5f, 0.5f, 0, color, circle); // Bottom-Left Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 - bWidth / 2), static_cast<float>(height + bHeight / 2 - cornerSize), cornerSize * 1.0f, cornerSize * 1.0f, 0, 0.5f, 0.5f, 0, color, circle); // Bottom-Left
Game::R_AddCmdDrawStretchPic(width / 2 + bWidth / 2 - cornerSize, height + bHeight / 2 - cornerSize, cornerSize, cornerSize, 0.5f, 0.5f, 0, 0, color, circle); // Bottom-Right Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 + bWidth / 2 - cornerSize), static_cast<float>(height + bHeight / 2 - cornerSize), cornerSize * 1.0f, cornerSize * 1.0f, 0.5f, 0.5f, 0, 0, color, circle); // Bottom-Right
// Border // Border
Game::R_AddCmdDrawStretchPic(width / 2 - bWidth / 2 + cornerSize, height - bHeight / 2 + aCorners, bWidth - cornerSize * 2, cornerSize - aCorners, 0, 0, 1.0f, 1.0f, color, white); // Top Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 - bWidth / 2 + cornerSize), static_cast<float>(height - bHeight / 2 + aCorners), static_cast<float>(bWidth - cornerSize * 2), static_cast<float>(cornerSize - aCorners), 0, 0, 1.0f, 1.0f, color, white); // Top
Game::R_AddCmdDrawStretchPic(width / 2 - bWidth / 2 + cornerSize, height + bHeight / 2 - cornerSize, bWidth - cornerSize * 2, cornerSize - aCorners, 0, 0, 1.0f, 1.0f, color, white); // Bottom Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 - bWidth / 2 + cornerSize), static_cast<float>(height + bHeight / 2 - cornerSize), static_cast<float>(bWidth - cornerSize * 2), static_cast<float>(cornerSize - aCorners), 0, 0, 1.0f, 1.0f, color, white); // Bottom
Game::R_AddCmdDrawStretchPic(width / 2 - bWidth / 2 + aCorners, height - bHeight / 2 + cornerSize, cornerSize - aCorners, bHeight - cornerSize * 2, 0, 0, 1.0f, 1.0f, color, white); // Left Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 - bWidth / 2 + aCorners), static_cast<float>(height - bHeight / 2 + cornerSize), static_cast<float>(cornerSize - aCorners), static_cast<float>(bHeight - cornerSize * 2), 0, 0, 1.0f, 1.0f, color, white); // Left
Game::R_AddCmdDrawStretchPic(width / 2 + bWidth / 2 - cornerSize, height - bHeight / 2 + cornerSize, cornerSize - aCorners, bHeight - cornerSize * 2, 0, 0, 1.0f, 1.0f, color, white); // Right Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 + bWidth / 2 - cornerSize), static_cast<float>(height - bHeight / 2 + cornerSize), static_cast<float>(cornerSize - aCorners), static_cast<float>(bHeight - cornerSize * 2), 0, 0, 1.0f, 1.0f, color, white); // Right
// Center // Center
Game::R_AddCmdDrawStretchPic(width / 2 - (bWidth - cornerSize * 2) / 2, height - (bHeight - cornerSize * 2) / 2, bWidth - cornerSize * 2, bHeight - cornerSize * 2, 0, 0, 1.0f, 1.0f, color, white); Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 - (bWidth - cornerSize * 2) / 2), static_cast<float>(height - (bHeight - cornerSize * 2) / 2), static_cast<float>(bWidth - cornerSize * 2), static_cast<float>(bHeight - cornerSize * 2), 0, 0, 1.0f, 1.0f, color, white);
// Image // Image
Game::R_AddCmdDrawStretchPic(width / 2 - bWidth / 2 + iOffsetLeft, height - bHeight / 2 + iOffset, imgDim, imgDim, 0, 0, 1.0f, 1.0f, wColor, image); Game::CL_DrawStretchPicPhysical(static_cast<float>(width / 2 - bWidth / 2 + iOffsetLeft), static_cast<float>(height - bHeight / 2 + iOffset), imgDim * 1.0f, imgDim * 1.0f, 0, 0, 1.0f, 1.0f, wColor, image);
// Text // Text
int leftText = width / 2 - bWidth / 2 - cornerSize + iOffsetLeft * 2 + imgDim; int leftText = width / 2 - bWidth / 2 - cornerSize + iOffsetLeft * 2 + imgDim;
int rightText = width / 2 + bWidth / 2 - cornerSize - aCorners - iOffsetLeft; int rightText = width / 2 + bWidth / 2 - cornerSize - aCorners - iOffsetLeft;
Game::R_AddCmdDrawText(toast->Title.data(), 0x7FFFFFFF, font, leftText + (rightText - leftText) / 2 - titleSize / 2 + cornerSize, height - bHeight / 2 + cornerSize * 2 + 7, 1.0f, 1.0f, 0, wColor, 0); // Title Game::R_AddCmdDrawText(toast->Title.data(), 0x7FFFFFFF, font, static_cast<float>(leftText + (rightText - leftText) / 2 - titleSize / 2 + cornerSize), static_cast<float>(height - bHeight / 2 + cornerSize * 2 + 7), 1.0f, 1.0f, 0, wColor, 0); // Title
Game::R_AddCmdDrawText(toast->Desc.data(), 0x7FFFFFFF, font, leftText + (rightText - leftText) / 2 - descrSize / 2 + cornerSize, height - bHeight / 2 + cornerSize * 2 + 33, 1.0f, 1.0f, 0, wColor, 0); // Description Game::R_AddCmdDrawText(toast->Desc.data(), 0x7FFFFFFF, font, static_cast<float>(leftText + (rightText - leftText) / 2 - descrSize / 2 + cornerSize), static_cast<float>(height - bHeight / 2 + cornerSize * 2 + 33), 1.0f, 1.0f, 0, wColor, 0); // Description
#pragma warning(pop)
} }
void Toast::Handler() void Toast::Handler()
@ -148,7 +143,7 @@ namespace Components
Command::Add("testtoast", [] (Command::Params) Command::Add("testtoast", [] (Command::Params)
{ {
Toast::Show("specialty_nuke", "Test", "This is a test toast", 3000); Toast::Show("cardicon_prestige10", "Test", "This is a test toast", 3000);
}); });
} }

View File

@ -12,6 +12,7 @@ namespace Game
CL_IsCgameInitialized_t CL_IsCgameInitialized = (CL_IsCgameInitialized_t)0x43EB20; CL_IsCgameInitialized_t CL_IsCgameInitialized = (CL_IsCgameInitialized_t)0x43EB20;
CL_ConnectFromParty_t CL_ConnectFromParty = (CL_ConnectFromParty_t)0x433D30; CL_ConnectFromParty_t CL_ConnectFromParty = (CL_ConnectFromParty_t)0x433D30;
CL_DownloadsComplete_t CL_DownloadsComplete = (CL_DownloadsComplete_t)0x42CE90; CL_DownloadsComplete_t CL_DownloadsComplete = (CL_DownloadsComplete_t)0x42CE90;
CL_DrawStretchPicPhysical_t CL_DrawStretchPicPhysical = (CL_DrawStretchPicPhysical_t)0x4FC120;
CL_ResetViewport_t CL_ResetViewport = (CL_ResetViewport_t)0x4A8830; CL_ResetViewport_t CL_ResetViewport = (CL_ResetViewport_t)0x4A8830;
Cmd_AddCommand_t Cmd_AddCommand = (Cmd_AddCommand_t)0x470090; Cmd_AddCommand_t Cmd_AddCommand = (Cmd_AddCommand_t)0x470090;

View File

@ -21,6 +21,9 @@ namespace Game
typedef void(__cdecl * CL_DownloadsComplete_t)(int controller); typedef void(__cdecl * CL_DownloadsComplete_t)(int controller);
extern CL_DownloadsComplete_t CL_DownloadsComplete; extern CL_DownloadsComplete_t CL_DownloadsComplete;
typedef void(_cdecl * CL_DrawStretchPicPhysical_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, Game::Material* material);
extern CL_DrawStretchPicPhysical_t CL_DrawStretchPicPhysical;
typedef void(__cdecl * CL_ResetViewport_t)(); typedef void(__cdecl * CL_ResetViewport_t)();
extern CL_ResetViewport_t CL_ResetViewport; extern CL_ResetViewport_t CL_ResetViewport;
@ -302,7 +305,7 @@ namespace Game
typedef void(__cdecl * R_AddCmdDrawText_t)(const char *text, int maxChars, Font *font, float x, float y, float xScale, float yScale, float rotation, const float *color, int style); typedef void(__cdecl * R_AddCmdDrawText_t)(const char *text, int maxChars, Font *font, float x, float y, float xScale, float yScale, float rotation, const float *color, int style);
extern R_AddCmdDrawText_t R_AddCmdDrawText; extern R_AddCmdDrawText_t R_AddCmdDrawText;
typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, void* material); typedef void(_cdecl * R_AddCmdDrawStretchPic_t)(float x, float y, float w, float h, float xScale, float yScale, float xay, float yay, const float *color, Game::Material* material);
extern R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic; extern R_AddCmdDrawStretchPic_t R_AddCmdDrawStretchPic;
typedef void(__cdecl * R_LoadGraphicsAssets_t)(); typedef void(__cdecl * R_LoadGraphicsAssets_t)();