Checkpoint/3ds/source/main.cpp

60 lines
2 KiB
C++
Raw Normal View History

2018-05-14 06:52:41 +00:00
/*
2019-05-06 20:51:09 +00:00
* This file is part of Checkpoint
* Copyright (C) 2017-2019 Bernardo Giordano, FlagBrew
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
2017-09-29 07:45:56 +00:00
2019-04-21 16:05:26 +00:00
#include "main.hpp"
2019-07-07 13:35:18 +00:00
#include "MainScreen.hpp"
2019-04-22 20:02:33 +00:00
#include "thread.hpp"
#include "util.hpp"
2017-09-29 07:45:56 +00:00
2019-05-06 20:51:09 +00:00
int main()
{
2018-12-14 21:14:05 +00:00
if (R_FAILED(servicesInit())) {
return -1;
}
2019-07-07 13:35:18 +00:00
g_screen = std::make_unique<MainScreen>();
2018-05-14 06:52:41 +00:00
Threads::create((ThreadFunc)Threads::titles);
2019-07-10 19:31:06 +00:00
ATEXIT(Threads::destroy);
2017-09-29 07:45:56 +00:00
2019-07-07 13:35:18 +00:00
while (aptMainLoop() && !(hidKeysDown() & KEY_START)) {
touchPosition touch;
2018-05-14 06:52:41 +00:00
hidScanInput();
2019-07-07 13:35:18 +00:00
hidTouchRead(&touch);
2019-07-08 20:22:38 +00:00
if (Configuration::getInstance().shouldScanCard()) {
updateCard();
}
2019-03-07 20:13:15 +00:00
2019-07-07 13:35:18 +00:00
C3D_FrameBegin(C3D_FRAME_SYNCDRAW);
g_screen->doDrawTop();
C2D_SceneBegin(g_bottom);
g_screen->doDrawBottom();
Gui::frameEnd();
g_screen->doUpdate(&touch);
2018-05-14 06:52:41 +00:00
}
2018-05-26 07:36:00 +00:00
}