mirror of
https://github.com/Team-Neptune/DeepSea-Updater.git
synced 2024-11-23 12:29:52 +00:00
Small Fixes. All Done Scene completed.
This commit is contained in:
parent
87b8770096
commit
c752b59eaf
@ -47,6 +47,7 @@ SDL_Color AssetManager::disabled_text;
|
||||
PlFontData AssetManager::standardFontData;
|
||||
TTF_Font * AssetManager::header_font = NULL;
|
||||
TTF_Font * AssetManager::body_font = NULL;
|
||||
TTF_Font * AssetManager::subbody_font = NULL;
|
||||
PlFontData AssetManager::extendedFontData;
|
||||
TTF_Font * AssetManager::button_font = NULL;
|
||||
|
||||
@ -54,6 +55,9 @@ void AssetManager::dealloc() {
|
||||
if (AssetManager::button_font != NULL)
|
||||
TTF_CloseFont(AssetManager::button_font);
|
||||
|
||||
if (AssetManager::subbody_font != NULL)
|
||||
TTF_CloseFont(AssetManager::subbody_font);
|
||||
|
||||
if (AssetManager::body_font != NULL)
|
||||
TTF_CloseFont(AssetManager::body_font);
|
||||
|
||||
@ -77,7 +81,7 @@ void AssetManager::dealloc() {
|
||||
|
||||
if (AssetManager::a_button != NULL)
|
||||
SDL_DestroyTexture(AssetManager::a_button);
|
||||
};
|
||||
}
|
||||
|
||||
bool AssetManager::initialize() {
|
||||
Result rc;
|
||||
@ -121,6 +125,7 @@ bool AssetManager::initialize() {
|
||||
|
||||
AssetManager::header_font = TTF_OpenFontRW(SDL_RWFromMem(AssetManager::standardFontData.address, AssetManager::standardFontData.size), 1, 28);
|
||||
AssetManager::body_font = TTF_OpenFontRW(SDL_RWFromMem(AssetManager::standardFontData.address, AssetManager::standardFontData.size), 1, 23);
|
||||
AssetManager::subbody_font = TTF_OpenFontRW(SDL_RWFromMem(AssetManager::standardFontData.address, AssetManager::standardFontData.size), 1, 18);
|
||||
if (!AssetManager::header_font || !AssetManager::body_font)
|
||||
return false;
|
||||
|
||||
@ -133,7 +138,7 @@ bool AssetManager::initialize() {
|
||||
return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
void AssetManager::setRenderColor(SDL_Color color) {
|
||||
SDL_SetRenderDrawColor(SceneDirector::renderer, color.r, color.g, color.b, color.a);
|
||||
@ -146,4 +151,4 @@ SDL_Texture * AssetManager::loadAsset(string file) {
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(SceneDirector::renderer, image);
|
||||
SDL_FreeSurface(image);
|
||||
return texture;
|
||||
};
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ class AssetManager {
|
||||
static PlFontData standardFontData;
|
||||
static TTF_Font * header_font;
|
||||
static TTF_Font * body_font;
|
||||
static TTF_Font * subbody_font;
|
||||
static PlFontData extendedFontData;
|
||||
static TTF_Font * button_font;
|
||||
|
||||
@ -63,4 +64,4 @@ class AssetManager {
|
||||
static void dealloc();
|
||||
static void setRenderColor(SDL_Color color);
|
||||
static SDL_Texture * loadAsset(string file);
|
||||
};
|
||||
};
|
||||
|
@ -17,8 +17,49 @@
|
||||
|
||||
#include "Scene.hpp"
|
||||
|
||||
Scene::Scene() {}
|
||||
Scene::Scene() {
|
||||
_touchedView = NULL;
|
||||
}
|
||||
|
||||
Scene::~Scene() {}
|
||||
|
||||
void Scene::render(SDL_Rect rect, double dTime) {}
|
||||
void Scene::handleButton(u32 buttons) {}
|
||||
|
||||
void Scene::render(SDL_Rect rect, double dTime) {
|
||||
for (list<View *>::iterator it = subviews.begin(); it != subviews.end(); it++) {
|
||||
SDL_Rect subviewFrame = (*it)->frame;
|
||||
(*it)->render({ rect.x + subviewFrame.x, rect.y + subviewFrame.y, subviewFrame.w, subviewFrame.h });
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::touchStarted() {
|
||||
for (list<View *>::iterator it = subviews.begin(); it != subviews.end(); it++) {
|
||||
// TODO: Check if touch is within the view
|
||||
if ((*it)->isTouchable) {
|
||||
_touchedView = (*it);
|
||||
_touchedView->touchStarted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::touchMoved() {
|
||||
if (_touchedView != NULL) {
|
||||
_touchedView->touchMoved();
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::touchEnded() {
|
||||
if (_touchedView != NULL) {
|
||||
_touchedView->touchEnded();
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::addSubView(View * view) {
|
||||
view->superview = NULL;
|
||||
subviews.push_back(view);
|
||||
}
|
||||
|
||||
void Scene::removeSubView(View * view) {
|
||||
view->superview = NULL;
|
||||
subviews.remove(view);
|
||||
}
|
||||
|
@ -18,6 +18,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <switch.h>
|
||||
#include <list>
|
||||
#include "View.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -26,5 +29,19 @@ class Scene {
|
||||
Scene();
|
||||
virtual ~Scene();
|
||||
|
||||
virtual void handleButton(u32 buttons);
|
||||
virtual void render(SDL_Rect rect, double dTime);
|
||||
|
||||
/* Touch Controls */
|
||||
void touchStarted();
|
||||
void touchMoved();
|
||||
void touchEnded();
|
||||
|
||||
/* View Hierarchy */
|
||||
list<View *> subviews;
|
||||
void addSubView(View * view);
|
||||
void removeSubView(View * view);
|
||||
|
||||
private:
|
||||
View * _touchedView;
|
||||
};
|
||||
|
@ -50,9 +50,8 @@ SceneDirector::SceneDirector() {
|
||||
_last = 0;
|
||||
_allDoneScene = NULL;
|
||||
_appUpdateScene = NULL;
|
||||
_downloadingAppScene = NULL;
|
||||
_downloadingPackageScene = NULL;
|
||||
_packageSelectScene = NULL;
|
||||
_currentScene = NULL;
|
||||
}
|
||||
|
||||
SceneDirector::~SceneDirector() {
|
||||
@ -62,12 +61,6 @@ SceneDirector::~SceneDirector() {
|
||||
if (_appUpdateScene != NULL)
|
||||
delete _appUpdateScene;
|
||||
|
||||
if (_downloadingAppScene != NULL)
|
||||
delete _downloadingAppScene;
|
||||
|
||||
if (_downloadingPackageScene != NULL)
|
||||
delete _downloadingPackageScene;
|
||||
|
||||
if (_packageSelectScene != NULL)
|
||||
delete _packageSelectScene;
|
||||
|
||||
@ -102,16 +95,10 @@ bool SceneDirector::direct() {
|
||||
// Unload previous scenes
|
||||
switch(SceneDirector::currentScene) {
|
||||
case SCENE_PACKAGE_SELECT:
|
||||
case SCENE_DOWNLOADING_PACKAGE:
|
||||
if (_appUpdateScene != NULL) {
|
||||
delete _appUpdateScene;
|
||||
_appUpdateScene = NULL;
|
||||
}
|
||||
|
||||
if (_downloadingAppScene != NULL) {
|
||||
delete _downloadingAppScene;
|
||||
_downloadingAppScene = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCENE_ALL_DONE:
|
||||
@ -120,20 +107,11 @@ bool SceneDirector::direct() {
|
||||
_appUpdateScene = NULL;
|
||||
}
|
||||
|
||||
if (_downloadingAppScene != NULL) {
|
||||
delete _downloadingAppScene;
|
||||
_downloadingAppScene = NULL;
|
||||
}
|
||||
|
||||
if (_packageSelectScene != NULL) {
|
||||
delete _packageSelectScene;
|
||||
_packageSelectScene = NULL;
|
||||
}
|
||||
|
||||
if (_downloadingPackageScene != NULL) {
|
||||
delete _downloadingPackageScene;
|
||||
_downloadingPackageScene = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -150,13 +128,6 @@ bool SceneDirector::direct() {
|
||||
_currentScene = _appUpdateScene;
|
||||
break;
|
||||
|
||||
case SCENE_DOWNLOADING_APP:
|
||||
if (_downloadingAppScene == NULL)
|
||||
_downloadingAppScene = new DownloadingAppScene();
|
||||
|
||||
_currentScene = _downloadingAppScene;
|
||||
break;
|
||||
|
||||
case SCENE_PACKAGE_SELECT:
|
||||
if (_packageSelectScene == NULL)
|
||||
_packageSelectScene = new PackageSelectScene();
|
||||
@ -164,13 +135,6 @@ bool SceneDirector::direct() {
|
||||
_currentScene = _packageSelectScene;
|
||||
break;
|
||||
|
||||
case SCENE_DOWNLOADING_PACKAGE:
|
||||
if (_downloadingPackageScene == NULL)
|
||||
_downloadingPackageScene = new DownloadingPackageScene();
|
||||
|
||||
_currentScene = _downloadingPackageScene;
|
||||
break;
|
||||
|
||||
case SCENE_ALL_DONE:
|
||||
if (_allDoneScene == NULL)
|
||||
_allDoneScene = new AllDoneScene();
|
||||
@ -179,9 +143,10 @@ bool SceneDirector::direct() {
|
||||
break;
|
||||
}
|
||||
|
||||
_currentScene->handleButton(kDown);
|
||||
_currentScene->render({ 0, 0, 1280, 720 }, dTime);
|
||||
|
||||
SDL_RenderPresent(SceneDirector::renderer);
|
||||
|
||||
return !SceneDirector::exitApp;
|
||||
};
|
||||
}
|
||||
|
@ -23,15 +23,11 @@
|
||||
|
||||
#include "scenes/AllDoneScene.hpp"
|
||||
#include "scenes/AppUpdateScene.hpp"
|
||||
#include "scenes/DownloadingAppScene.hpp"
|
||||
#include "scenes/DownloadingPackageScene.hpp"
|
||||
#include "scenes/PackageSelectScene.hpp"
|
||||
|
||||
typedef enum {
|
||||
SCENE_APP_UPDATE,
|
||||
SCENE_DOWNLOADING_APP,
|
||||
SCENE_PACKAGE_SELECT,
|
||||
SCENE_DOWNLOADING_PACKAGE,
|
||||
SCENE_ALL_DONE
|
||||
} Scenes;
|
||||
|
||||
@ -56,7 +52,5 @@ class SceneDirector {
|
||||
Scene * _currentScene;
|
||||
AllDoneScene * _allDoneScene;
|
||||
AppUpdateScene * _appUpdateScene;
|
||||
DownloadingAppScene * _downloadingAppScene;
|
||||
DownloadingPackageScene * _downloadingPackageScene;
|
||||
PackageSelectScene * _packageSelectScene;
|
||||
};
|
||||
};
|
||||
|
@ -43,4 +43,4 @@ void View::addSubView(View * view) {
|
||||
void View::removeSubView(View * view) {
|
||||
view->superview = NULL;
|
||||
subviews.remove(view);
|
||||
}
|
||||
}
|
||||
|
@ -46,4 +46,4 @@ class View {
|
||||
list<View *> subviews;
|
||||
void addSubView(View * view);
|
||||
void removeSubView(View * view);
|
||||
};
|
||||
};
|
||||
|
@ -15,12 +15,4 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "DownloadingPackageScene.hpp"
|
||||
|
||||
DownloadingPackageScene::DownloadingPackageScene() {}
|
||||
|
||||
DownloadingPackageScene::~DownloadingPackageScene() {}
|
||||
|
||||
void DownloadingPackageScene::render(SDL_Rect rect, double dTime) {
|
||||
|
||||
}
|
||||
#include "Touch.hpp"
|
@ -15,12 +15,9 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "DownloadingAppScene.hpp"
|
||||
#pragma once
|
||||
|
||||
DownloadingAppScene::DownloadingAppScene() {}
|
||||
using namespace std;
|
||||
|
||||
DownloadingAppScene::~DownloadingAppScene() {}
|
||||
|
||||
void DownloadingAppScene::render(SDL_Rect rect, double dTime) {
|
||||
|
||||
}
|
||||
class Touch {
|
||||
};
|
@ -16,11 +16,51 @@
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "AllDoneScene.hpp"
|
||||
#include "../SceneDirector.hpp"
|
||||
#include "../AssetManager.hpp"
|
||||
|
||||
AllDoneScene::AllDoneScene() {}
|
||||
AllDoneScene::AllDoneScene() {
|
||||
_headerView = new HeaderView();
|
||||
_headerView->frame = { 0, 0, 1280, 88 };
|
||||
|
||||
AllDoneScene::~AllDoneScene() {}
|
||||
_textView = new TextView(AssetManager::body_font, "SD Files has been updated to version 9.0.4!", AssetManager::text);
|
||||
_textView->frame = { 0, 323, 1280, 1 };
|
||||
_textView->textAlignment = CENTER_ALIGN;
|
||||
|
||||
_subtextView = new TextView(AssetManager::subbody_font, "Please restart your Switch to run the latest SD Files.", AssetManager::text);
|
||||
_subtextView->frame = { 0, 375, 1280, 1 };
|
||||
_subtextView->textAlignment = CENTER_ALIGN;
|
||||
|
||||
_footerView = new FooterView();
|
||||
_footerView->frame = { 0, 647, 1280, 73 };
|
||||
_footerView->actions.push_back(new Action(A_BUTTON, "Quit"));
|
||||
|
||||
addSubView(_headerView);
|
||||
addSubView(_textView);
|
||||
addSubView(_subtextView);
|
||||
addSubView(_footerView);
|
||||
}
|
||||
|
||||
AllDoneScene::~AllDoneScene() {
|
||||
if (_headerView != NULL)
|
||||
delete _headerView;
|
||||
|
||||
if (_textView != NULL)
|
||||
delete _textView;
|
||||
|
||||
if (_subtextView != NULL)
|
||||
delete _subtextView;
|
||||
|
||||
if (_footerView != NULL)
|
||||
delete _footerView;
|
||||
}
|
||||
|
||||
void AllDoneScene::handleButton(u32 buttons) {
|
||||
if (buttons & KEY_A) {
|
||||
SceneDirector::exitApp = true;
|
||||
}
|
||||
}
|
||||
|
||||
void AllDoneScene::render(SDL_Rect rect, double dTime) {
|
||||
|
||||
Scene::render(rect, dTime);
|
||||
}
|
||||
|
@ -18,13 +18,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Scene.hpp"
|
||||
#include "../views/HeaderView.hpp"
|
||||
#include "../views/TextView.hpp"
|
||||
#include "../views/FooterView.hpp"
|
||||
|
||||
class AllDoneScene : public Scene {
|
||||
public:
|
||||
AllDoneScene();
|
||||
~AllDoneScene();
|
||||
|
||||
void handleButton(u32 buttons);
|
||||
void render(SDL_Rect rect, double dTime);
|
||||
|
||||
private:
|
||||
HeaderView * _headerView;
|
||||
TextView * _textView;
|
||||
TextView * _subtextView;
|
||||
FooterView * _footerView;
|
||||
};
|
||||
|
@ -16,11 +16,33 @@
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#include "AppUpdateScene.hpp"
|
||||
#include "../SceneDirector.hpp"
|
||||
|
||||
AppUpdateScene::AppUpdateScene() {}
|
||||
AppUpdateScene::AppUpdateScene() {
|
||||
_headerView = new HeaderView();
|
||||
_headerView->frame = { 0, 0, 1280, 88 };
|
||||
|
||||
AppUpdateScene::~AppUpdateScene() {}
|
||||
_footerView = new FooterView();
|
||||
_footerView->frame = { 0, 647, 1280, 73 };
|
||||
|
||||
addSubView(_headerView);
|
||||
addSubView(_footerView);
|
||||
}
|
||||
|
||||
AppUpdateScene::~AppUpdateScene() {
|
||||
if (_headerView != NULL)
|
||||
delete _headerView;
|
||||
|
||||
if (_footerView != NULL)
|
||||
delete _footerView;
|
||||
}
|
||||
|
||||
void AppUpdateScene::handleButton(u32 buttons) {
|
||||
if (buttons & KEY_A) {
|
||||
SceneDirector::currentScene = SCENE_ALL_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
void AppUpdateScene::render(SDL_Rect rect, double dTime) {
|
||||
|
||||
Scene::render(rect, dTime);
|
||||
}
|
||||
|
@ -18,13 +18,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Scene.hpp"
|
||||
#include "../views/HeaderView.hpp"
|
||||
#include "../views/FooterView.hpp"
|
||||
|
||||
class AppUpdateScene : public Scene {
|
||||
public:
|
||||
AppUpdateScene();
|
||||
~AppUpdateScene();
|
||||
|
||||
void handleButton(u32 buttons);
|
||||
void render(SDL_Rect rect, double dTime);
|
||||
|
||||
private:
|
||||
HeaderView * _headerView;
|
||||
FooterView * _footerView;
|
||||
};
|
||||
|
@ -1,30 +0,0 @@
|
||||
// SDFiles Updater
|
||||
// Copyright (C) 2018 Steven Mattera
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../Scene.hpp"
|
||||
|
||||
class DownloadingAppScene : public Scene {
|
||||
public:
|
||||
DownloadingAppScene();
|
||||
~DownloadingAppScene();
|
||||
|
||||
void render(SDL_Rect rect, double dTime);
|
||||
|
||||
private:
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
// SDFiles Updater
|
||||
// Copyright (C) 2018 Steven Mattera
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../Scene.hpp"
|
||||
|
||||
class DownloadingPackageScene : public Scene {
|
||||
public:
|
||||
DownloadingPackageScene();
|
||||
~DownloadingPackageScene();
|
||||
|
||||
void render(SDL_Rect rect, double dTime);
|
||||
|
||||
private:
|
||||
};
|
@ -17,10 +17,29 @@
|
||||
|
||||
#include "PackageSelectScene.hpp"
|
||||
|
||||
PackageSelectScene::PackageSelectScene() {}
|
||||
PackageSelectScene::PackageSelectScene() {
|
||||
_headerView = new HeaderView();
|
||||
_headerView->frame = { 0, 0, 1280, 88 };
|
||||
|
||||
PackageSelectScene::~PackageSelectScene() {}
|
||||
_footerView = new FooterView();
|
||||
_footerView->frame = { 0, 647, 1280, 73 };
|
||||
|
||||
addSubView(_headerView);
|
||||
addSubView(_footerView);
|
||||
}
|
||||
|
||||
PackageSelectScene::~PackageSelectScene() {
|
||||
if (_headerView != NULL)
|
||||
delete _headerView;
|
||||
|
||||
if (_footerView != NULL)
|
||||
delete _footerView;
|
||||
}
|
||||
|
||||
void PackageSelectScene::handleButton(u32 buttons) {
|
||||
|
||||
}
|
||||
|
||||
void PackageSelectScene::render(SDL_Rect rect, double dTime) {
|
||||
|
||||
Scene::render(rect, dTime);
|
||||
}
|
||||
|
@ -18,13 +18,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Scene.hpp"
|
||||
#include "../views/HeaderView.hpp"
|
||||
#include "../views/FooterView.hpp"
|
||||
|
||||
class PackageSelectScene : public Scene {
|
||||
public:
|
||||
PackageSelectScene();
|
||||
~PackageSelectScene();
|
||||
|
||||
void handleButton(u32 buttons);
|
||||
void render(SDL_Rect rect, double dTime);
|
||||
|
||||
private:
|
||||
HeaderView * _headerView;
|
||||
FooterView * _footerView;
|
||||
};
|
||||
|
@ -55,4 +55,4 @@ void HeaderView::render(SDL_Rect rect) {
|
||||
|
||||
// Render any subviews
|
||||
View::render(rect);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
TextView::TextView(TTF_Font * theFont, string theText, SDL_Color theTextColor) : View() {
|
||||
isFocusable = false;
|
||||
isTouchable = false;
|
||||
textAlignment = LEFT_ALIGN;
|
||||
_textTexture = NULL;
|
||||
|
||||
font = theFont;
|
||||
text = theText;
|
||||
@ -42,8 +44,24 @@ void TextView::render(SDL_Rect rect) {
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
int width = max(_textWidth, rect.w);
|
||||
switch (textAlignment) {
|
||||
case LEFT_ALIGN:
|
||||
x = rect.x;
|
||||
break;
|
||||
|
||||
case CENTER_ALIGN:
|
||||
x = (width - _textWidth) / 2;
|
||||
break;
|
||||
|
||||
case RIGHT_ALIGN:
|
||||
x = width - _textWidth;
|
||||
break;
|
||||
}
|
||||
|
||||
// Render the text.
|
||||
SDL_Rect textFrame = { rect.x, rect.y, min(_textWidth, rect.w), min(_textHeight, rect.h) };
|
||||
SDL_Rect textFrame = { x, rect.y, _textWidth, _textHeight };
|
||||
SDL_RenderCopy(SceneDirector::renderer, _textTexture, NULL, &textFrame);
|
||||
|
||||
// Render any subviews.
|
||||
@ -73,4 +91,4 @@ void TextView::_reset() {
|
||||
|
||||
_textWidth = 0;
|
||||
_textHeight = 0;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,12 @@
|
||||
#include <string>
|
||||
#include "../View.hpp"
|
||||
|
||||
typedef enum {
|
||||
LEFT_ALIGN,
|
||||
CENTER_ALIGN,
|
||||
RIGHT_ALIGN
|
||||
} TextAlignment;
|
||||
|
||||
using namespace std;
|
||||
|
||||
class TextView : public View {
|
||||
@ -28,6 +34,7 @@ class TextView : public View {
|
||||
TTF_Font * font;
|
||||
string text;
|
||||
SDL_Color textColor;
|
||||
TextAlignment textAlignment;
|
||||
|
||||
TextView(TTF_Font * theFont, string theText, SDL_Color theTextColor);
|
||||
~TextView();
|
||||
|
Loading…
Reference in New Issue
Block a user