mirror of
https://github.com/bdnugget/CatacombGL.git
synced 2026-11-07 08:57:33 +00:00
Refactor TilesSize8Utility into RenderableTiles
This commit is contained in:
1 parent
a8382b5216
commit
8a755fe9b5
14 files changed
+166
-132
No files matched your search
+1
-3
@@ -33,9 +33,7 @@
|
||||
*.ipdb
|
||||
*.log
|
||||
*.tlog
|
||||
VS2015/.vs
|
||||
VS2017/.vs
|
||||
VS2017_llvm/.vs
|
||||
VS2019/.vs
|
||||
*.db
|
||||
*.opendb
|
||||
build/
|
||||
|
||||
File renamed without changes.
@@ -17,7 +17,7 @@
|
||||
#include "AudioRepositoryCatacomb3D.h"
|
||||
#include "..\..\ThirdParty\SDL\include\SDL_keyboard.h"
|
||||
#include "..\Engine\DefaultFont.h"
|
||||
#include "..\Engine\TilesSize8Utility.h"
|
||||
#include "..\Engine\IRenderer.h"
|
||||
|
||||
const uint8_t subMenuMain = 0;
|
||||
const uint8_t subMenuVideo = 1;
|
||||
@@ -877,9 +877,9 @@ void Catacomb3DMenu::DrawTiledWindow(IRenderer& renderer, EgaGraph* const egaGra
|
||||
{
|
||||
renderer.Render2DBar(x * 8, y * 8, width * 8, height * 8, EgaBrightWhite);
|
||||
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
TilesSize8Utility::DrawWindow(images, x, y, width, height);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8Masked());
|
||||
RenderableTiles tiles(*egaGraph->GetTilesSize8Masked());
|
||||
tiles.DrawWindow(x, y, width, height);
|
||||
renderer.RenderTiles(tiles);
|
||||
}
|
||||
|
||||
void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const uint16_t menuCursorPic, const uint32_t timeStamp)
|
||||
@@ -900,9 +900,9 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
|
||||
const int16_t thx = 88;
|
||||
const int16_t thy = 96;
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
TilesSize8Utility::DrawDialog(images, thx, thy, 18);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
RenderableTiles tiles (*egaGraph->GetTilesSize8());
|
||||
tiles.DrawDialog(thx, thy, 18);
|
||||
renderer.RenderTiles(tiles);
|
||||
|
||||
const uint16_t progress = ((timeStamp - m_menuActivatedTimestamp) * 136) / loadingDuration;
|
||||
renderer.Render2DBar(thx + 4, thy + 5, progress, 14, EgaBrightYellow);
|
||||
@@ -934,33 +934,33 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
const bool flashIcon = ((timeStamp / 1000) % 2 == 0);
|
||||
if (m_subMenuSelected == subMenuMain)
|
||||
{
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles renderableTiles(*egaGraph->GetTilesSize8());
|
||||
RenderableText renderableText(*egaGraph->GetFont(4));
|
||||
renderer.Render2DBar(77, 55, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DBar(77, 133, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DPicture(egaGraph->GetPicture(CP_MAINMENUPIC), 80, 48);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableText.LeftAligned("NEW GAME", (m_menuItemSelected == 0) ? EgaBrightRed : EgaRed, 120, 63);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 70, m_savedGames.size() > 0, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 70, m_savedGames.size() > 0, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableText.LeftAligned("LOAD GAME", (m_menuItemSelected == 1) ? EgaBrightRed : EgaRed, 120, 71);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 78, m_saveGameEnabled, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 78, m_saveGameEnabled, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableText.LeftAligned("SAVE GAME", (m_menuItemSelected == 2) ? EgaBrightRed : EgaRed, 120, 79);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 86, true, (m_menuItemSelected == 3) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 86, true, (m_menuItemSelected == 3) && flashIcon);
|
||||
renderableText.LeftAligned("CONFIGURE", (m_menuItemSelected == 3) ? EgaBrightRed : EgaRed, 120, 87);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 94, true, (m_menuItemSelected == 4) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 94, true, (m_menuItemSelected == 4) && flashIcon);
|
||||
const char* returnOptionText = (m_saveGameEnabled) ? "RETURN TO GAME" : "RETURN TO DEMO";
|
||||
renderableText.LeftAligned(returnOptionText, (m_menuItemSelected == 4) ? EgaBrightRed : EgaRed, 120, 95);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 102, m_saveGameEnabled, (m_menuItemSelected == 5) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 102, m_saveGameEnabled, (m_menuItemSelected == 5) && flashIcon);
|
||||
renderableText.LeftAligned("END GAME", (m_menuItemSelected == 5) ? EgaBrightRed : EgaRed, 120, 103);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 110, true, (m_menuItemSelected == 6) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 110, true, (m_menuItemSelected == 6) && flashIcon);
|
||||
renderableText.LeftAligned("SKULL 'N' BONES", (m_menuItemSelected == 6) ? EgaBrightRed : EgaRed, 120, 111);
|
||||
TilesSize8Utility::DrawListBullet(images, 112, 118, true, (m_menuItemSelected == 7) && flashIcon);
|
||||
renderableTiles.DrawListBullet(112, 118, true, (m_menuItemSelected == 7) && flashIcon);
|
||||
renderableText.LeftAligned("QUIT", (m_menuItemSelected == 7) ? EgaBrightRed : EgaRed, 120, 119);
|
||||
|
||||
renderableText.LeftAligned("Arrows move", EgaRed, 78, 135);
|
||||
renderableText.LeftAligned("Enter selects", EgaRed, 163, 135);
|
||||
renderableText.Centered("Esc to close", EgaRed, 154, 144);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
renderer.RenderTiles(renderableTiles);
|
||||
renderer.RenderText(renderableText);
|
||||
|
||||
if (m_askForQuit)
|
||||
@@ -975,22 +975,22 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
}
|
||||
else if (m_subMenuSelected == subMenuNewGame)
|
||||
{
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles renderableTiles(*egaGraph->GetTilesSize8());
|
||||
RenderableText renderableText(*egaGraph->GetFont(4));
|
||||
renderer.Render2DBar(77, 55, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DBar(77, 133, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DPicture(egaGraph->GetPicture(CP_NEWGAMEMENUPIC), 80, 48);
|
||||
TilesSize8Utility::DrawListBullet(images, 88, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableTiles.DrawListBullet(88, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableText.LeftAligned("BEGIN EASY GAME", (m_menuItemSelected == 0) ? EgaBrightRed : EgaRed, 96, 63);
|
||||
TilesSize8Utility::DrawListBullet(images, 88, 70, true, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(88, 70, true, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableText.LeftAligned("BEGIN NORMAL GAME", (m_menuItemSelected == 1) ? EgaBrightRed : EgaRed, 96, 71);
|
||||
TilesSize8Utility::DrawListBullet(images, 88, 78, true, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableTiles.DrawListBullet(88, 78, true, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableText.LeftAligned("BEGIN HARD GAME", (m_menuItemSelected == 2) ? EgaBrightRed : EgaRed, 96, 79);
|
||||
|
||||
renderableText.LeftAligned("Arrows move", EgaRed, 78, 135);
|
||||
renderableText.LeftAligned("Enter selects", EgaRed, 163, 135);
|
||||
renderableText.Centered("Esc to back out", EgaRed, 154, 144);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
renderer.RenderTiles(renderableTiles);
|
||||
renderer.RenderText(renderableText);
|
||||
|
||||
if (m_askForEndGame)
|
||||
@@ -1000,29 +1000,29 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
}
|
||||
else if (m_subMenuSelected == subMenuConfigure)
|
||||
{
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles renderableTiles(*egaGraph->GetTilesSize8());
|
||||
RenderableText renderableText(*egaGraph->GetFont(4));
|
||||
renderer.Render2DBar(77, 55, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DBar(77, 133, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DPicture(egaGraph->GetPicture(CP_CONFIGMENUPIC), 80, 48);
|
||||
TilesSize8Utility::DrawListBullet(images, 88, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableTiles.DrawListBullet(88, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableText.LeftAligned("SOUND", (m_menuItemSelected == 0) ? EgaBrightRed : EgaRed, 96, 63);
|
||||
TilesSize8Utility::DrawListBullet(images, 88, 70, true, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(88, 70, true, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableText.LeftAligned("MUSIC", (m_menuItemSelected == 1) ? EgaBrightRed : EgaRed, 96, 71);
|
||||
TilesSize8Utility::DrawListBullet(images, 88, 78, true, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableTiles.DrawListBullet(88, 78, true, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableText.LeftAligned("VIDEO", (m_menuItemSelected == 2) ? EgaBrightRed : EgaRed, 96, 79);
|
||||
TilesSize8Utility::DrawListBullet(images, 88, 86, true, (m_menuItemSelected == 3) && flashIcon);
|
||||
renderableTiles.DrawListBullet(88, 86, true, (m_menuItemSelected == 3) && flashIcon);
|
||||
renderableText.LeftAligned("CONTROLS", (m_menuItemSelected == 3) ? EgaBrightRed : EgaRed, 96, 87);
|
||||
|
||||
renderableText.LeftAligned("Arrows move", EgaRed, 78, 135);
|
||||
renderableText.LeftAligned("Enter selects", EgaRed, 163, 135);
|
||||
renderableText.Centered("Esc to back out", EgaRed, 154, 144);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
renderer.RenderTiles(renderableTiles);
|
||||
renderer.RenderText(renderableText);
|
||||
}
|
||||
else if (m_subMenuSelected == subMenuVideo)
|
||||
{
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles renderableTiles(*egaGraph->GetTilesSize8());
|
||||
|
||||
renderer.Render2DBar(77, 55, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DBar(77, 133, 154, 1, EgaBrightRed);
|
||||
@@ -1037,7 +1037,7 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
renderer.Render2DPictureSegment(egaGraph->GetPicture(CP_MAINMENUPIC), 112, 48, 30, 0, 34, 12); // MENU
|
||||
|
||||
RenderableText renderableText(*egaGraph->GetFont(4));
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 62, true, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableText.LeftAligned("Screen Mode", (m_menuItemSelected == 0) ? EgaBrightRed : EgaRed, 84, 63);
|
||||
const char* screenModeStr =
|
||||
(m_configurationSettings.GetScreenMode() == Windowed) ? "Windowed" :
|
||||
@@ -1045,28 +1045,28 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
"Borderless";
|
||||
renderableText.LeftAligned(screenModeStr, (m_menuItemSelected == 0) ? EgaLightGray : EgaDarkGray, 180, 63);
|
||||
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 70, true, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 70, true, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableText.LeftAligned("Aspect ratio", (m_menuItemSelected == 1) ? EgaBrightRed : EgaRed, 84, 70);
|
||||
const std::string& aspectRatioStr = aspectRatios[m_configurationSettings.GetAspectRatio()].description;
|
||||
renderableText.LeftAligned(aspectRatioStr, (m_menuItemSelected == 1) ? EgaLightGray : EgaDarkGray, 160, 71);
|
||||
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 78, true, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 78, true, (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableText.LeftAligned("Field Of View (Y)", (m_menuItemSelected == 2) ? EgaBrightRed : EgaRed, 84, 79);
|
||||
char fovStr[40];
|
||||
sprintf_s(fovStr, 40, "%d", m_configurationSettings.GetFov());
|
||||
renderableText.LeftAligned(fovStr, (m_menuItemSelected == 2) ? EgaLightGray : EgaDarkGray, 180, 79);
|
||||
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 86, true, (m_menuItemSelected == 3) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 86, true, (m_menuItemSelected == 3) && flashIcon);
|
||||
renderableText.LeftAligned("Texture filtering", (m_menuItemSelected == 3) ? EgaBrightRed : EgaRed, 84, 87);
|
||||
const char* textureFilterStr = (m_configurationSettings.GetTextureFilter() == IRenderer::Nearest) ? "Nearest" : "Linear";
|
||||
renderableText.LeftAligned(textureFilterStr, (m_menuItemSelected == 3) ? EgaLightGray : EgaDarkGray, 180, 87);
|
||||
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 94, true, (m_menuItemSelected == 4) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 94, true, (m_menuItemSelected == 4) && flashIcon);
|
||||
renderableText.LeftAligned("Depth shading", (m_menuItemSelected == 4) ? EgaBrightRed : EgaRed, 84, 95);
|
||||
const char* depthShadingStr = (m_configurationSettings.GetDepthShading()) ? "Enabled" : "Disabled";
|
||||
renderableText.LeftAligned(depthShadingStr, (m_menuItemSelected == 4) ? EgaLightGray : EgaDarkGray, 180, 95);
|
||||
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 102, true, (m_menuItemSelected == 5) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 102, true, (m_menuItemSelected == 5) && flashIcon);
|
||||
renderableText.LeftAligned("Show frame rate", (m_menuItemSelected == 5) ? EgaBrightRed : EgaRed, 84, 103);
|
||||
const ShowFpsMode showFpsMode = m_configurationSettings.GetShowFps();
|
||||
const char* showFpsStr =
|
||||
@@ -1076,7 +1076,7 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
renderableText.LeftAligned(showFpsStr, (m_menuItemSelected == 5) ? EgaLightGray : EgaDarkGray, 180, 103);
|
||||
|
||||
const bool vsyncSupported = renderer.IsVSyncSupported();
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 110, vsyncSupported, (m_menuItemSelected == 6) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 110, vsyncSupported, (m_menuItemSelected == 6) && flashIcon);
|
||||
renderableText.LeftAligned("VSync", (m_menuItemSelected == 6) ? EgaBrightRed : EgaRed, 84, 111);
|
||||
const char* vsyncStr = (!vsyncSupported) ? "Not supported" : (m_configurationSettings.GetVSync()) ? "Enabled" : "Disabled";
|
||||
renderableText.LeftAligned(vsyncStr, (m_menuItemSelected == 6) ? EgaLightGray : EgaDarkGray, !vsyncSupported ? 160 : 180, 111);
|
||||
@@ -1084,12 +1084,12 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
renderableText.LeftAligned("Arrows move", EgaRed, 78, 135);
|
||||
renderableText.LeftAligned("Enter selects", EgaRed, 163, 135);
|
||||
renderableText.Centered("Esc to back out", EgaRed, 154, 144);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
renderer.RenderTiles(renderableTiles);
|
||||
renderer.RenderText(renderableText);
|
||||
}
|
||||
else if (m_subMenuSelected == subMenuControls)
|
||||
{
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles renderableTiles(*egaGraph->GetTilesSize8());
|
||||
|
||||
renderer.Render2DBar(77, 55, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DBar(77, 133, 154, 1, EgaBrightRed);
|
||||
@@ -1102,7 +1102,7 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
{
|
||||
if (index + m_menuItemOffset < (uint16_t)m_configurationSettings.GetControlsMap().GetActionLabels().size())
|
||||
{
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
const std::string& actionLabel = m_configurationSettings.GetControlsMap().GetActionLabels().at((ControlAction)(index + m_menuItemOffset));
|
||||
const uint16_t yOffset = 63 + ((index - 1) * 8);
|
||||
renderableText.LeftAligned(actionLabel, (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaBrightRed : EgaRed, 84, yOffset);
|
||||
@@ -1118,14 +1118,14 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
}
|
||||
else if (index + m_menuItemOffset == m_configurationSettings.GetControlsMap().GetActionLabels().size())
|
||||
{
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableText.LeftAligned("Mouse Look", (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaBrightRed : EgaRed, 84, 55 + (index * 8));
|
||||
const char* mouseLookStr = (m_configurationSettings.GetMouseLook()) ? "Enabled" : "Disabled";
|
||||
renderableText.LeftAligned(mouseLookStr, (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaLightGray : EgaDarkGray, 160, 55 + (index * 8));
|
||||
}
|
||||
else if (index + m_menuItemOffset == m_configurationSettings.GetControlsMap().GetActionLabels().size() + 1)
|
||||
{
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableText.LeftAligned("Mouse Sens.", (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaBrightRed : EgaRed, 84, 55 + (index * 8));
|
||||
char mouseSensitivityStr[5];
|
||||
sprintf_s(mouseSensitivityStr, 5, "%d", m_configurationSettings.GetMouseSensitivity());
|
||||
@@ -1133,7 +1133,7 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
}
|
||||
else if (index + m_menuItemOffset == m_configurationSettings.GetControlsMap().GetActionLabels().size() + 2)
|
||||
{
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableText.LeftAligned("Turn Speed", (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaBrightRed : EgaRed, 84, 55 + (index * 8));
|
||||
char turnSpeedStr[5];
|
||||
sprintf_s(turnSpeedStr, 5, "%d", m_configurationSettings.GetTurnSpeed());
|
||||
@@ -1141,14 +1141,14 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
}
|
||||
else if (index + m_menuItemOffset == m_configurationSettings.GetControlsMap().GetActionLabels().size() + 3)
|
||||
{
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableText.LeftAligned("Always Run", (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaBrightRed : EgaRed, 84, 55 + (index * 8));
|
||||
const char* alwaysRunStr = (m_configurationSettings.GetAlwaysRun()) ? "Enabled" : "Disabled";
|
||||
renderableText.LeftAligned(alwaysRunStr, (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaLightGray : EgaDarkGray, 160, 55 + (index * 8));
|
||||
}
|
||||
else if (index + m_menuItemOffset == m_configurationSettings.GetControlsMap().GetActionLabels().size() + 4)
|
||||
{
|
||||
TilesSize8Utility::DrawListBullet(images, 76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableTiles.DrawListBullet(76, 62 + ((index - 1) * 8), true, (m_menuItemSelected == index + m_menuItemOffset - 1) && flashIcon);
|
||||
renderableText.LeftAligned("Auto Fire", (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaBrightRed : EgaRed, 84, 55 + (index * 8));
|
||||
const char* autoFireStr = (m_configurationSettings.GetAutoFire()) ? "Enabled" : "Disabled";
|
||||
renderableText.LeftAligned(autoFireStr, (m_menuItemSelected == index + m_menuItemOffset - 1) ? EgaLightGray : EgaDarkGray, 160, 55 + (index * 8));
|
||||
@@ -1160,50 +1160,50 @@ void Catacomb3DMenu::Draw(IRenderer& renderer, EgaGraph* const egaGraph, const u
|
||||
renderableText.LeftAligned("Arrows move", EgaRed, 78, 135);
|
||||
renderableText.LeftAligned("Enter selects", EgaRed, 163, 135);
|
||||
renderableText.Centered("Esc to back out", EgaRed, 154, 144);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
renderer.RenderTiles(renderableTiles);
|
||||
renderer.RenderText(renderableText);
|
||||
renderer.RenderText(renderableTextDefaultFont);
|
||||
}
|
||||
else if (m_subMenuSelected == subMenuSound)
|
||||
{
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles renderableTiles(*egaGraph->GetTilesSize8());
|
||||
RenderableText renderableText(*egaGraph->GetFont(4));
|
||||
renderer.Render2DBar(77, 55, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DBar(77, 133, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DPicture(egaGraph->GetPicture(CP_SOUNDMENUPIC), 80, 48);
|
||||
|
||||
const uint8_t soundMode = m_configurationSettings.GetSoundMode();
|
||||
TilesSize8Utility::DrawRadioButton(images, 88, 62, (soundMode == 0), (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableTiles.DrawRadioButton(88, 62, (soundMode == 0), (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableText.LeftAligned("NO SOUND EFFECTS", (m_menuItemSelected == 0) ? EgaBrightRed : EgaRed, 96, 63);
|
||||
TilesSize8Utility::DrawRadioButton(images, 88, 70, (soundMode == 1), (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableTiles.DrawRadioButton(88, 70, (soundMode == 1), (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableText.LeftAligned("PC SPEAKER", (m_menuItemSelected == 1) ? EgaBrightRed : EgaRed, 96, 71);
|
||||
TilesSize8Utility::DrawRadioButton(images, 88, 78, (soundMode == 2), (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableTiles.DrawRadioButton(88, 78, (soundMode == 2), (m_menuItemSelected == 2) && flashIcon);
|
||||
renderableText.LeftAligned("ADLIB/SOUNDBLASTER", (m_menuItemSelected == 2) ? EgaBrightRed : EgaRed, 96, 79);
|
||||
|
||||
renderableText.LeftAligned("Arrows move", EgaRed, 78, 135);
|
||||
renderableText.LeftAligned("Enter selects", EgaRed, 163, 135);
|
||||
renderableText.Centered("Esc to back out", EgaRed, 154, 144);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
renderer.RenderTiles(renderableTiles);
|
||||
renderer.RenderText(renderableText);
|
||||
}
|
||||
else if (m_subMenuSelected == subMenuMusic)
|
||||
{
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles renderableTiles(*egaGraph->GetTilesSize8());
|
||||
RenderableText renderableText(*egaGraph->GetFont(4));
|
||||
renderer.Render2DBar(77, 55, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DBar(77, 133, 154, 1, EgaBrightRed);
|
||||
renderer.Render2DPicture(egaGraph->GetPicture(CP_MUSICMENUPIC), 80, 48);
|
||||
|
||||
const bool musicOn = m_configurationSettings.GetMusicOn();
|
||||
TilesSize8Utility::DrawRadioButton(images, 88, 62, !musicOn, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableTiles.DrawRadioButton(88, 62, !musicOn, (m_menuItemSelected == 0) && flashIcon);
|
||||
renderableText.LeftAligned("NO MUSIC", (m_menuItemSelected == 0) ? EgaBrightRed : EgaRed, 96, 63);
|
||||
TilesSize8Utility::DrawRadioButton(images, 88, 70, musicOn, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableTiles.DrawRadioButton(88, 70, musicOn, (m_menuItemSelected == 1) && flashIcon);
|
||||
renderableText.LeftAligned("ADLIB/SOUNDBLASTER", (m_menuItemSelected == 1) ? EgaBrightRed : EgaRed, 96, 71);
|
||||
|
||||
renderableText.LeftAligned("Arrows move", EgaRed, 78, 135);
|
||||
renderableText.LeftAligned("Enter selects", EgaRed, 163, 135);
|
||||
renderableText.Centered("Esc to back out", EgaRed, 154, 144);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *egaGraph->GetTilesSize8());
|
||||
renderer.RenderTiles(renderableTiles);
|
||||
renderer.RenderText(renderableText);
|
||||
}
|
||||
else if (m_subMenuSelected == subMenuRestoreGame)
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "AudioRepositoryCatacomb3D.h"
|
||||
#include "DecorateAll.h"
|
||||
#include "..\Engine\IRenderer.h"
|
||||
#include "..\Engine\TilesSize8Utility.h"
|
||||
#include "Catacomb3DMenu.h"
|
||||
|
||||
static const std::string Catacomb3DName = "Catacomb 3-D v1.22";
|
||||
@@ -431,22 +430,22 @@ void GameCatacomb3D::DrawStatusBar(const int16_t health, const std::string& loca
|
||||
|
||||
const uint16_t maxItemsToShow = 9;
|
||||
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
RenderableTiles tiles(*GetEgaGraph()->GetTilesSize8());
|
||||
|
||||
const int8_t numBoltsToShow = (playerInventory.GetBolts() < maxItemsToShow) ? playerInventory.GetBolts() : maxItemsToShow;
|
||||
for (int8_t i = 0; i < numBoltsToShow; i++)
|
||||
{
|
||||
images.push_back({ 56 + (i * 8), 165, TilesSize8Utility::TileIdBolt });
|
||||
tiles.Add(56 + (i * 8), 165, RenderableTiles::TileIdBolt);
|
||||
}
|
||||
const int8_t numNukesToShow = (playerInventory.GetNukes() < maxItemsToShow) ? playerInventory.GetNukes() : maxItemsToShow;
|
||||
for (int8_t i = 0; i < numNukesToShow; i++)
|
||||
{
|
||||
images.push_back({ 56 + (i * 8), 175, TilesSize8Utility::TileIdNuke });
|
||||
tiles.Add(56 + (i * 8), 175, RenderableTiles::TileIdNuke);
|
||||
}
|
||||
const int8_t numPotionsToShow = (playerInventory.GetPotions() < maxItemsToShow) ? playerInventory.GetPotions() : maxItemsToShow;
|
||||
for (int8_t i = 0; i < numPotionsToShow; i++)
|
||||
{
|
||||
images.push_back({ 56 + (i * 8), 185, TilesSize8Utility::TileIdPotion });
|
||||
tiles.Add(56 + (i * 8), 185, RenderableTiles::TileIdPotion);
|
||||
}
|
||||
|
||||
int8_t x = 24;
|
||||
@@ -455,7 +454,7 @@ void GameCatacomb3D::DrawStatusBar(const int16_t health, const std::string& loca
|
||||
const int8_t numKeysToShow = playerInventory.GetKeys(i) > 2 ? 2 : playerInventory.GetKeys(i);
|
||||
for (int8_t j = 0; j < numKeysToShow; j++)
|
||||
{
|
||||
images.push_back({ (x * 8), 165, (uint16_t)(TilesSize8Utility::TileIdFirstKey + i) });
|
||||
tiles.Add((x * 8), 165, (uint16_t)(RenderableTiles::TileIdFirstKey + i));
|
||||
x++;
|
||||
}
|
||||
}
|
||||
@@ -464,7 +463,7 @@ void GameCatacomb3D::DrawStatusBar(const int16_t health, const std::string& loca
|
||||
{
|
||||
if (playerInventory.GetScroll(i))
|
||||
{
|
||||
images.push_back({ 192 + (i * 8), 175, (uint16_t)(TilesSize8Utility::TileIdFirstScroll + i) });
|
||||
tiles.Add(192 + (i * 8), 175, (uint16_t)(RenderableTiles::TileIdFirstScroll + i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,12 +474,12 @@ void GameCatacomb3D::DrawStatusBar(const int16_t health, const std::string& loca
|
||||
int16_t x = 256 - (8 * (int16_t)length);
|
||||
for (int16_t i = 0; i < length; i++)
|
||||
{
|
||||
images.push_back({ x, 185, (uint16_t)(TilesSize8Utility::TileIdFirstNumber + scoreStr.at(i) - '0' )});
|
||||
tiles.Add(x, 185, (uint16_t)(RenderableTiles::TileIdFirstNumber + scoreStr.at(i) - '0' ));
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
|
||||
m_renderer.RenderImagesFromTextureAtlas(images, *GetEgaGraph()->GetTilesSize8());
|
||||
m_renderer.RenderTiles(tiles);
|
||||
|
||||
DrawStatusBarWideScreenMargin(0 - wideScreenMargin, wideScreenMargin);
|
||||
DrawStatusBarWideScreenMargin(320 - sideBarWidth - 2, wideScreenMargin);
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
<ClCompile Include="Level.cpp" />
|
||||
<ClCompile Include="RenderableText.cpp" />
|
||||
<ClCompile Include="TextureAtlas.cpp" />
|
||||
<ClCompile Include="TilesSize8Utility.cpp" />
|
||||
<ClCompile Include="RenderableTiles.cpp" />
|
||||
<ClCompile Include="ViewPorts.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -230,7 +230,7 @@
|
||||
<ClInclude Include="Level.h" />
|
||||
<ClInclude Include="RenderableText.h" />
|
||||
<ClInclude Include="TextureAtlas.h" />
|
||||
<ClInclude Include="TilesSize8Utility.h" />
|
||||
<ClInclude Include="RenderableTiles.h" />
|
||||
<ClInclude Include="ViewPorts.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
@@ -159,10 +159,10 @@
|
||||
<ClCompile Include="TextureAtlas.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TilesSize8Utility.cpp">
|
||||
<ClCompile Include="RenderableText.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RenderableText.cpp">
|
||||
<ClCompile Include="RenderableTiles.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
@@ -311,10 +311,10 @@
|
||||
<ClInclude Include="TextureAtlas.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TilesSize8Utility.h">
|
||||
<ClInclude Include="RenderableText.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RenderableText.h">
|
||||
<ClInclude Include="RenderableTiles.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "..\..\ThirdParty\RefKeen\id_sd.h"
|
||||
#include "LevelLocationNames.h"
|
||||
#include "DefaultFont.h"
|
||||
#include "TilesSize8Utility.h"
|
||||
#include "RenderableTiles.h"
|
||||
#include <math.h>
|
||||
#include <fstream>
|
||||
|
||||
@@ -497,9 +497,9 @@ void EngineCore::DrawTiledWindow(IRenderer& renderer, const uint16_t x, const ui
|
||||
{
|
||||
renderer.Render2DBar(x * 8, y * 8, width * 8, height * 8, EgaLightGray);
|
||||
|
||||
std::vector<IRenderer::imageOnTextureAtlas> images;
|
||||
TilesSize8Utility::DrawWindow(images, x, y, width, height);
|
||||
renderer.RenderImagesFromTextureAtlas(images, *m_game.GetEgaGraph()->GetTilesSize8Masked());
|
||||
RenderableTiles tiles(*m_game.GetEgaGraph()->GetTilesSize8Masked());
|
||||
tiles.DrawWindow(x, y, width, height);
|
||||
renderer.RenderTiles(tiles);
|
||||
}
|
||||
|
||||
void EngineCore::EnterKeyReleased()
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ViewPorts.h"
|
||||
#include "TextureAtlas.h"
|
||||
#include "RenderableText.h"
|
||||
#include "RenderableTiles.h"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -58,13 +59,6 @@ public:
|
||||
uint16_t y2;
|
||||
} wallCoordinate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int16_t offsetX;
|
||||
int16_t offsetY;
|
||||
uint16_t imageIndex;
|
||||
} imageOnTextureAtlas;
|
||||
|
||||
enum TextureFilterSetting
|
||||
{
|
||||
Nearest,
|
||||
@@ -108,7 +102,7 @@ public:
|
||||
virtual void Render2DPicture(const Picture* picture, const uint16_t offsetX, const uint16_t offsetY) = 0;
|
||||
virtual void Render2DPictureSegment(const Picture* picture, const int16_t offsetX, const int16_t offsetY, const uint16_t segmentOffsetX, const uint16_t segmentOffsetY, const uint16_t segmentWidth, const uint16_t segmentHeight) = 0;
|
||||
virtual void Render2DBar(const int16_t x, const int16_t y, const uint16_t width, const uint16_t height, const egaColor colorIndex) = 0;
|
||||
virtual void RenderImagesFromTextureAtlas(const std::vector<imageOnTextureAtlas>& images, const TextureAtlas& textureAtlas) = 0;
|
||||
virtual void RenderTiles(const RenderableTiles& renderableTiles) = 0;
|
||||
virtual TextureAtlas* CreateTextureAtlasForTilesSize8(const FileChunk* decompressedChunk, const bool masked) = 0;
|
||||
|
||||
virtual void Prepare3DRendering(const bool depthShading, const float aspectRatio, uint16_t fov, const ViewPorts::ViewPortRect3D original3DViewArea) = 0;
|
||||
|
||||
@@ -13,10 +13,33 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
|
||||
#include "TilesSize8Utility.h"
|
||||
#include "RenderableTiles.h"
|
||||
|
||||
void TilesSize8Utility::DrawWindow(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
RenderableTiles::RenderableTiles(const TextureAtlas& textureAtlas) :
|
||||
m_textureAtlas(textureAtlas),
|
||||
m_tiles()
|
||||
{
|
||||
}
|
||||
|
||||
const std::vector<RenderableTiles::RenderableTile>& RenderableTiles::GetTiles() const
|
||||
{
|
||||
return m_tiles;
|
||||
}
|
||||
|
||||
const TextureAtlas& RenderableTiles::GetTextureAtlas() const
|
||||
{
|
||||
return m_textureAtlas;
|
||||
}
|
||||
|
||||
void RenderableTiles::Add(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const uint16_t tileId)
|
||||
{
|
||||
m_tiles.push_back({ x, y, tileId });
|
||||
}
|
||||
|
||||
void RenderableTiles::DrawWindow(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const uint16_t width,
|
||||
@@ -28,48 +51,46 @@ void TilesSize8Utility::DrawWindow(
|
||||
const int16_t sw = (width + 1) * 8;
|
||||
const int16_t sh = (height + 1) * 8;
|
||||
|
||||
outputImages.push_back({ sx, sy, TileIdWindowTopLeft });
|
||||
outputImages.push_back({ sx, sy + sh, TileIdWindowBottomLeft });
|
||||
m_tiles.push_back({ sx, sy, TileIdWindowTopLeft });
|
||||
m_tiles.push_back({ sx, sy + sh, TileIdWindowBottomLeft });
|
||||
|
||||
for (int16_t i = sx + 8; i <= sx + sw - 8; i += 8)
|
||||
{
|
||||
outputImages.push_back({ i, sy, TileIdWindowTop });
|
||||
outputImages.push_back({ i, sy + sh, TileIdWindowBottom });
|
||||
m_tiles.push_back({ i, sy, TileIdWindowTop });
|
||||
m_tiles.push_back({ i, sy + sh, TileIdWindowBottom });
|
||||
}
|
||||
outputImages.push_back({ sx + sw, sy, TileIdWindowTopRight });
|
||||
outputImages.push_back({ sx + sw, sy + sh, TileIdWindowBottomRight });
|
||||
m_tiles.push_back({ sx + sw, sy, TileIdWindowTopRight });
|
||||
m_tiles.push_back({ sx + sw, sy + sh, TileIdWindowBottomRight });
|
||||
|
||||
for (int16_t i = sy + 8; i <= sy + sh - 8; i += 8)
|
||||
{
|
||||
outputImages.push_back({ sx, i, TileIdWindowLeft });
|
||||
outputImages.push_back({ sx + sw, i, TileIdWindowRight });
|
||||
m_tiles.push_back({ sx, i, TileIdWindowLeft });
|
||||
m_tiles.push_back({ sx + sw, i, TileIdWindowRight });
|
||||
}
|
||||
}
|
||||
|
||||
void TilesSize8Utility::DrawDialog(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
void RenderableTiles::DrawDialog(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const uint16_t length)
|
||||
{
|
||||
// Based on CAL_DialogDraw in ID_CA.C
|
||||
outputImages.push_back({ x, y, TileIdWindowTopLeft });
|
||||
outputImages.push_back({ x, y + 8, TileIdWindowLeft });
|
||||
outputImages.push_back({ x, y + 16, TileIdWindowBottomLeft });
|
||||
outputImages.push_back({ x + (length - 1) * 8, y, TileIdWindowTopRight });
|
||||
outputImages.push_back({ x + (length - 1) * 8, y + 8, TileIdWindowRight });
|
||||
outputImages.push_back({ x + (length - 1) * 8, y + 16, TileIdWindowBottomRight });
|
||||
m_tiles.push_back({ x, y, TileIdWindowTopLeft });
|
||||
m_tiles.push_back({ x, y + 8, TileIdWindowLeft });
|
||||
m_tiles.push_back({ x, y + 16, TileIdWindowBottomLeft });
|
||||
m_tiles.push_back({ x + (length - 1) * 8, y, TileIdWindowTopRight });
|
||||
m_tiles.push_back({ x + (length - 1) * 8, y + 8, TileIdWindowRight });
|
||||
m_tiles.push_back({ x + (length - 1) * 8, y + 16, TileIdWindowBottomRight });
|
||||
|
||||
for (int16_t x2 = x + 8; x2 < x + (length - 1) * 8; x2 += 8)
|
||||
{
|
||||
outputImages.push_back({ x2, y, TileIdWindowTop });
|
||||
outputImages.push_back({ x2, y + 8, TileIdWindowCenter });
|
||||
outputImages.push_back({ x2, y + 16, TileIdWindowBottom });
|
||||
m_tiles.push_back({ x2, y, TileIdWindowTop });
|
||||
m_tiles.push_back({ x2, y + 8, TileIdWindowCenter });
|
||||
m_tiles.push_back({ x2, y + 16, TileIdWindowBottom });
|
||||
}
|
||||
}
|
||||
|
||||
void TilesSize8Utility::DrawListBullet(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
void RenderableTiles::DrawListBullet(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const bool enable,
|
||||
@@ -80,11 +101,10 @@ void TilesSize8Utility::DrawListBullet(
|
||||
(enable && !flash) ? TileIdListBulletEnabled :
|
||||
(!enable && flash) ? TileIdListBulletDisabledFlashing :
|
||||
TileIdListBulletDisabled;
|
||||
outputImages.push_back({ x, y, imageId });
|
||||
m_tiles.push_back({ x, y, imageId });
|
||||
}
|
||||
|
||||
void TilesSize8Utility::DrawRadioButton(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
void RenderableTiles::DrawRadioButton(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const bool selected,
|
||||
@@ -95,5 +115,5 @@ void TilesSize8Utility::DrawRadioButton(
|
||||
(selected && !flash) ? TileIdListBulletEnabled :
|
||||
(!selected && flash) ? TileIdListRadioButtonNotSelectedFlashing :
|
||||
TileIdListRadioButtonNotSelected;
|
||||
outputImages.push_back({ x, y, imageId });
|
||||
m_tiles.push_back({ x, y, imageId });
|
||||
}
|
||||
@@ -16,30 +16,50 @@
|
||||
// Supporting class for creating graphics out of the tiles with an 8 x 8 size.
|
||||
#pragma once
|
||||
|
||||
#include "IRenderer.h"
|
||||
//
|
||||
// RenderableTiles
|
||||
//
|
||||
// Converts tiles into a format that can be processed by the renderer.
|
||||
//
|
||||
|
||||
class TilesSize8Utility
|
||||
#include "TextureAtlas.h"
|
||||
#include <vector>
|
||||
|
||||
class RenderableTiles
|
||||
{
|
||||
public:
|
||||
static void DrawWindow(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
typedef struct
|
||||
{
|
||||
int16_t offsetX;
|
||||
int16_t offsetY;
|
||||
uint16_t imageIndex;
|
||||
} RenderableTile;
|
||||
|
||||
RenderableTiles(const TextureAtlas& textureAtlas);
|
||||
|
||||
const std::vector<RenderableTile>& GetTiles() const;
|
||||
const TextureAtlas& GetTextureAtlas() const;
|
||||
|
||||
void Add(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const uint16_t tileId);
|
||||
|
||||
void DrawWindow(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const uint16_t width,
|
||||
const uint16_t height);
|
||||
static void DrawDialog(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
void DrawDialog(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const uint16_t length);
|
||||
static void DrawListBullet(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
void DrawListBullet(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const bool enable,
|
||||
const bool flash);
|
||||
static void DrawRadioButton(
|
||||
std::vector<IRenderer::imageOnTextureAtlas>& outputImages,
|
||||
void DrawRadioButton(
|
||||
const int16_t x,
|
||||
const int16_t y,
|
||||
const bool selected,
|
||||
@@ -68,7 +88,8 @@ public:
|
||||
static const uint16_t TileIdListBulletDisabledFlashing = 97u;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<RenderableTile> m_tiles;
|
||||
const TextureAtlas& m_textureAtlas;
|
||||
};
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ void RendererStub::Render2DBar(const int16_t /*x*/, const int16_t /*y*/, const u
|
||||
{
|
||||
}
|
||||
|
||||
void RendererStub::RenderImagesFromTextureAtlas(const std::vector<imageOnTextureAtlas>& /*images*/, const TextureAtlas& /*textureAtlas*/)
|
||||
void RendererStub::RenderTiles(const RenderableTiles& /*renderableTiles*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
void Render2DPicture(const Picture* picture, const uint16_t offsetX, const uint16_t offsetY) override;
|
||||
void Render2DPictureSegment(const Picture* picture, const int16_t offsetX, const int16_t offsetY, const uint16_t segmentOffsetX, const uint16_t segmentOffsetY, const uint16_t segmentWidth, const uint16_t segmentHeight) override;
|
||||
void Render2DBar(const int16_t x, const int16_t y, const uint16_t width, const uint16_t height, const egaColor colorIndex) override;
|
||||
void RenderImagesFromTextureAtlas(const std::vector<imageOnTextureAtlas>& images, const TextureAtlas& textureAtlas) override;
|
||||
void RenderTiles(const RenderableTiles& renderableTiles) override;
|
||||
TextureAtlas* CreateTextureAtlasForTilesSize8(const FileChunk* decompressedChunk, const bool masked) override;
|
||||
|
||||
void Prepare3DRendering(const bool depthShading, const float aspectRatio, uint16_t fov, const ViewPorts::ViewPortRect3D original3DViewArea) override;
|
||||
|
||||
@@ -502,8 +502,10 @@ void RendererOpenGLWin32::Render2DBar(const int16_t x, const int16_t y, const ui
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void RendererOpenGLWin32::RenderImagesFromTextureAtlas(const std::vector<imageOnTextureAtlas>& images, const TextureAtlas& textureAtlas)
|
||||
void RendererOpenGLWin32::RenderTiles(const RenderableTiles& renderableTiles)
|
||||
{
|
||||
const TextureAtlas& textureAtlas = renderableTiles.GetTextureAtlas();
|
||||
const std::vector<RenderableTiles::RenderableTile>& tiles = renderableTiles.GetTiles();
|
||||
const int16_t imageWidth = (int16_t)textureAtlas.GetImageWidth();
|
||||
const int16_t imageHeight = (int16_t)textureAtlas.GetImageWidth();
|
||||
const float imageRelWidth = textureAtlas.GetImageRelativeWidth();
|
||||
@@ -512,12 +514,12 @@ void RendererOpenGLWin32::RenderImagesFromTextureAtlas(const std::vector<imageOn
|
||||
BindTexture(textureAtlas.GetTextureId());
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
for (const imageOnTextureAtlas& image : images)
|
||||
for (const RenderableTiles::RenderableTile& tile : tiles)
|
||||
{
|
||||
const int16_t offsetX = image.offsetX;
|
||||
const int16_t offsetY = image.offsetY;
|
||||
const float imageRelOffsetX = textureAtlas.GetImageRelativeOffsetX(image.imageIndex);
|
||||
const float imageRelOffsetY = textureAtlas.GetImageRelativeOffsetY(image.imageIndex);
|
||||
const int16_t offsetX = tile.offsetX;
|
||||
const int16_t offsetY = tile.offsetY;
|
||||
const float imageRelOffsetX = textureAtlas.GetImageRelativeOffsetX(tile.imageIndex);
|
||||
const float imageRelOffsetY = textureAtlas.GetImageRelativeOffsetY(tile.imageIndex);
|
||||
|
||||
glTexCoord2f(imageRelOffsetX + imageRelWidth, imageRelOffsetY + imageRelHeight); glVertex2i(offsetX + imageWidth, offsetY + imageHeight);
|
||||
glTexCoord2f(imageRelOffsetX, imageRelOffsetY + imageRelHeight); glVertex2i(offsetX, offsetY + imageHeight);
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
void Render2DPicture(const Picture* picture, const uint16_t offsetX, const uint16_t offsetY) override;
|
||||
void Render2DPictureSegment(const Picture* picture, const int16_t offsetX, const int16_t offsetY, const uint16_t segmentOffsetX, const uint16_t segmentOffsetY, const uint16_t segmentWidth, const uint16_t segmentHeight) override;
|
||||
void Render2DBar(const int16_t x, const int16_t y, const uint16_t width, const uint16_t height, const egaColor colorIndex) override;
|
||||
void RenderImagesFromTextureAtlas(const std::vector<imageOnTextureAtlas>& images, const TextureAtlas& textureAtlas) override;
|
||||
void RenderTiles(const RenderableTiles& renderableTiles) override;
|
||||
TextureAtlas* CreateTextureAtlasForTilesSize8(const FileChunk* decompressedChunk, const bool masked) override;
|
||||
|
||||
void Prepare3DRendering(const bool depthShading, const float aspectRatio, uint16_t fov, const ViewPorts::ViewPortRect3D original3DViewArea) override;
|
||||
|
||||
Reference in new issue
Block a user