finish refactor, add docs and CI
This commit is contained in:
+14
-11
@@ -1,9 +1,12 @@
|
||||
#include <nxst/app/main_application.hpp>
|
||||
#include <nxst/domain/util.hpp>
|
||||
#include <nxst/app/main.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace ui { extern MainApplication* mainApp; }
|
||||
#include <nxst/app/main.hpp>
|
||||
#include <nxst/app/main_application.hpp>
|
||||
#include <nxst/domain/util.hpp>
|
||||
|
||||
namespace ui {
|
||||
extern MainApplication* mainApp;
|
||||
}
|
||||
|
||||
static int nxlink_sock = -1;
|
||||
|
||||
@@ -25,9 +28,9 @@ extern "C" void userAppExit() {
|
||||
if (ui::mainApp) {
|
||||
ui::mainApp->transfer.cancelReceive();
|
||||
ui::mainApp->transfer.cancelSend();
|
||||
for (int i = 0; i < 150 &&
|
||||
(!ui::mainApp->transfer.isReceiveWorkersIdle() ||
|
||||
!ui::mainApp->transfer.isSendWorkersIdle()); i++) {
|
||||
for (int i = 0; i < 150 && (!ui::mainApp->transfer.isReceiveWorkersIdle() ||
|
||||
!ui::mainApp->transfer.isSendWorkersIdle());
|
||||
i++) {
|
||||
usleep(10000);
|
||||
}
|
||||
}
|
||||
@@ -57,8 +60,8 @@ int main() {
|
||||
|
||||
// First create our renderer, where one can customize SDL or other stuff's
|
||||
// initialization.
|
||||
auto renderer_opts = pu::ui::render::RendererInitOptions(
|
||||
SDL_INIT_EVERYTHING, pu::ui::render::RendererHardwareFlags);
|
||||
auto renderer_opts =
|
||||
pu::ui::render::RendererInitOptions(SDL_INIT_EVERYTHING, pu::ui::render::RendererHardwareFlags);
|
||||
renderer_opts.UseImage(pu::ui::render::IMGAllFlags);
|
||||
renderer_opts.UseAudio(pu::ui::render::MixerAllFlags);
|
||||
renderer_opts.UseTTF();
|
||||
@@ -68,7 +71,7 @@ int main() {
|
||||
renderer_opts.SetExtraDefaultFontSize(theme::type::Title);
|
||||
renderer_opts.SetExtraDefaultFontSize(theme::type::Display);
|
||||
|
||||
auto renderer = pu::ui::render::Renderer::New(renderer_opts);
|
||||
auto renderer = pu::ui::render::Renderer::New(renderer_opts);
|
||||
|
||||
// Create our main application from the renderer
|
||||
auto main = ui::MainApplication::New(renderer);
|
||||
@@ -78,5 +81,5 @@ int main() {
|
||||
main->Show();
|
||||
|
||||
servicesExit();
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
#include <string>
|
||||
#include <switch.h>
|
||||
#include <switch/services/hid.h>
|
||||
#include <vector>
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
#include <nxst/app/main_application.hpp>
|
||||
|
||||
namespace ui {
|
||||
MainApplication *mainApp;
|
||||
MainApplication* mainApp;
|
||||
|
||||
void MainApplication::OnLoad() {
|
||||
mainApp = this;
|
||||
this->users_layout = UsersLayout::New();
|
||||
this->titles_layout = TitlesLayout::New();
|
||||
this->users_layout->SetOnInput(
|
||||
std::bind(&UsersLayout::onInput, this->users_layout, std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4));
|
||||
this->titles_layout->SetOnInput(std::bind(&TitlesLayout::onInput, this->titles_layout, std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4));
|
||||
this->LoadLayout(this->users_layout);
|
||||
}
|
||||
}
|
||||
void MainApplication::OnLoad() {
|
||||
mainApp = this;
|
||||
this->users_layout = UsersLayout::New();
|
||||
this->titles_layout = TitlesLayout::New();
|
||||
this->users_layout->SetOnInput(std::bind(&UsersLayout::onInput, this->users_layout, std::placeholders::_1,
|
||||
std::placeholders::_2, std::placeholders::_3,
|
||||
std::placeholders::_4));
|
||||
this->titles_layout->SetOnInput(std::bind(&TitlesLayout::onInput, this->titles_layout,
|
||||
std::placeholders::_1, std::placeholders::_2,
|
||||
std::placeholders::_3, std::placeholders::_4));
|
||||
this->LoadLayout(this->users_layout);
|
||||
}
|
||||
} // namespace ui
|
||||
Reference in New Issue
Block a user