aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2021-05-29 21:40:12 -0400
committerJon Santmyer <jon@jonsantmyer.com>2021-05-29 21:40:12 -0400
commite1925a6c3837931d04aee6e94234310fb59f33e2 (patch)
treee579f1f182cfb693243ee3bd9d728478b9371227
parent51682452fad8ca99d9085f46a0572dab12a6a991 (diff)
downloadpostmodern-e1925a6c3837931d04aee6e94234310fb59f33e2.tar.gz
postmodern-e1925a6c3837931d04aee6e94234310fb59f33e2.tar.bz2
postmodern-e1925a6c3837931d04aee6e94234310fb59f33e2.zip
remove prebuilt so
. add proper border to pause screen. order selection elements spaced by draw region instead of total window area
-rw-r--r--.gitignore1
-rwxr-xr-xbin/libboxii.sobin240808 -> 0 bytes
m---------boxii0
-rw-r--r--include/titlescreen.h3
-rw-r--r--src/pausescreen.cpp29
-rw-r--r--src/titlescreen.cpp20
6 files changed, 31 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index d28cdfc..7510136 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*.o
+*.so
postmodern
include/boxii
diff --git a/bin/libboxii.so b/bin/libboxii.so
deleted file mode 100755
index 981ffa3..0000000
--- a/bin/libboxii.so
+++ /dev/null
Binary files differ
diff --git a/boxii b/boxii
-Subproject b4ddbcd99dfc5d4209efa549e94827c2db1e36b
+Subproject 916c00bd409f5ff7bad34714254d93744e6fd55
diff --git a/include/titlescreen.h b/include/titlescreen.h
index 509ea11..182230a 100644
--- a/include/titlescreen.h
+++ b/include/titlescreen.h
@@ -26,6 +26,9 @@ public:
TitleScreen();
~TitleScreen();
+ void activate() override;
+ void deactivate() override;
+
void update() override;
};
diff --git a/src/pausescreen.cpp b/src/pausescreen.cpp
index 4bb6f4a..399bf54 100644
--- a/src/pausescreen.cpp
+++ b/src/pausescreen.cpp
@@ -7,27 +7,16 @@
static const int selectionCount = 3;
static const std::string selectionText[selectionCount] =
{
- " Resume ",
- " Settings ",
- " Abort "
+ "Resume ",
+ "Settings",
+ "Abort "
};
static void
printSelections(std::shared_ptr<Boxii::TextWindow> menuWindow, int selection)
{
- int optx = 1;
- int opty = 1;
-
- menuWindow->clear(0xFFFFFF, 0x888888);
- for(int y = 1; y < menuWindow->getHeight() - 1; y++)
- for(int x = 1; x < menuWindow->getWidth() - 1; x++){
- menuWindow->plot(x, y, ' ', 0xFFFFFF, 0x0);
- }
-
- menuWindow->setfg(0x0);
- menuWindow->setbg(0x888888);
- menuWindow->moveCursor(1, 0);
- menuWindow->print("The game is Paused");
+ int optx = 0;
+ int opty = 0;
for(int i = 0; i < selectionCount; i++){
menuWindow->setfg(0xFFFFFF);
@@ -36,7 +25,10 @@ printSelections(std::shared_ptr<Boxii::TextWindow> menuWindow, int selection)
menuWindow->setfg(0x0);
menuWindow->setbg(0xFFFFFF);
}
- menuWindow->moveCursor(optx, opty++);
+ int dw = menuWindow->getBodyWidth() / 2;
+ dw -= selectionText[i].length() / 2;
+
+ menuWindow->moveCursor(dw, opty++);
menuWindow->print("%s", selectionText[i].c_str());
}
}
@@ -48,12 +40,13 @@ PauseScreen::PauseScreen() :
int sw = Boxii::getTerminalWidth();
int sh = Boxii::getTerminalHeight();
- int menuWidth = 20;
+ int menuWidth = 15;
int menuHeight = 10;
int menuX = (sw / 2) - (menuWidth / 2);
int menuY = (sh / 2) - (menuHeight / 2);
m_menuWindow = Boxii::makeWindow<Boxii::TextWindow>(menuX, menuY / 2, menuWidth, menuHeight);
+ m_menuWindow->border('+', '+', '+', '+', '-', '|', 0xFFFFFF, 0x0);
Boxii::remove(m_menuWindow);
printSelections(m_menuWindow, m_selection);
diff --git a/src/titlescreen.cpp b/src/titlescreen.cpp
index 14c97e5..fc23a75 100644
--- a/src/titlescreen.cpp
+++ b/src/titlescreen.cpp
@@ -49,11 +49,9 @@ static const std::string selectionTexts[selectionsTotal] =
static void
printSelections(std::shared_ptr<Boxii::TextWindow> selectionWindow, int selection)
{
- int selwidth = selectionWindow->getWidth() / selectionsTotal;
+ int selwidth = selectionWindow->getBodyWidth() / selectionsTotal;
int selcenter = selwidth / 2;
- int sely = (selectionWindow->getHeight() / 3) * 2;
-
- selectionWindow->clear(0xFFFFFF, 0x0);
+ int sely = (selectionWindow->getBodyHeight() / 2);
for(int i = 0; i < selectionsTotal; i++){
if(selection == i){
@@ -92,6 +90,20 @@ TitleScreen::~TitleScreen()
}
void
+TitleScreen::activate()
+{
+ Boxii::pushToFront(m_graphicWindow);
+ Boxii::pushToFront(m_selectionWindow);
+}
+
+void
+TitleScreen::deactivate()
+{
+ Boxii::remove(m_graphicWindow);
+ Boxii::remove(m_selectionWindow);
+}
+
+void
TitleScreen::parseSelection()
{
if(m_selection == static_cast<int>(Selection::QUIT)) Game::stop();