Skip to content

Commit

Permalink
Added simple calculator tab view layout
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmmaTech committed Jul 23, 2021
1 parent 026240d commit 0073030
Show file tree
Hide file tree
Showing 12 changed files with 256 additions and 3 deletions.
12 changes: 12 additions & 0 deletions include/calculatorTab.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <borealis.hpp>

struct CalculatorTab : public brls::Box
{
CalculatorTab();

static brls::View* create();

private:
};
8 changes: 8 additions & 0 deletions include/mainActivity.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#include <borealis.hpp>

struct MainActivity : public brls::Activity
{
CONTENT_FROM_XML_RES("activity/main.xml")
};
1 change: 1 addition & 0 deletions resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shaders/**
13 changes: 13 additions & 0 deletions resources/i18n/en-US/text.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"title": "Calculator_NX Rewrite",

"tabs": {
"calculator": "Calculator",
"settings": "Settings",
"about": "About Calculator_NX"
},

"calculator": {
"expression_enter": "Enter an expression"
}
}
Binary file removed resources/shaders/fill_aa_fsh.dksh
Binary file not shown.
Binary file removed resources/shaders/fill_fsh.dksh
Binary file not shown.
Binary file removed resources/shaders/fill_vsh.dksh
Binary file not shown.
16 changes: 16 additions & 0 deletions resources/xml/activity/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<brls:TabFrame
title="@i18n/text/title"
iconInterpolation="linear"
icon="@res/icon/Calculator_NX_Icon_Alt.jpg">

<brls:Tab label="@i18n/text/tabs/calculator">
<CalculatorTab />
</brls:Tab>

<brls:Tab label="@i18n/text/tabs/settings"/>

<brls:Separator/>

<brls:Tab label="@i18n/text/tabs/about"/>

</brls:TabFrame>
179 changes: 179 additions & 0 deletions resources/xml/tabs/calculator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<brls:Box
width="auto"
height="auto"
axis="column">

<brls:Box
width="500"
height="500"
axis="column">

<brls:Box
width="100%"
height="20%">

<brls:Label
width="auto"
height="auto"
text="@i18n/text/calculator/expression_enter"
fontSize="25"/>

</brls:Box>

<brls:Box
width="100%"
height="80%">

<brls:Box
width="20%"
height="100%"
axis="column">

<brls:Button
width="auto"
height="auto"
style="primary"
text="("/>

<brls:Button
width="auto"
height="auto"
style="primary"
text=")"/>

</brls:Box>

<brls:Box
width="20%"
height="100%"
axis="column">

<brls:Button
width="auto"
height="auto"
style="primary"
text="9"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="6"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="3"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="0"/>

</brls:Box>

<brls:Box
width="20%"
height="100%"
axis="column">

<brls:Button
width="auto"
height="auto"
style="primary"
text="8"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="5"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="2"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="."/>

</brls:Box>

<brls:Box
width="20%"
height="100%"
axis="column">

<brls:Button
width="auto"
height="auto"
style="primary"
text="7"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="4"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="1"/>

<brls:Rectangle
width="auto"
height="auto"
color="#000000"/>

</brls:Box>

<brls:Box
width="20%"
height="100%"
axis="column">

<brls:Button
width="auto"
height="auto"
style="primary"
text="+"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="-"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="*"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="/"/>

<brls:Button
width="auto"
height="auto"
style="primary"
text="="/>

</brls:Box>

</brls:Box>

</brls:Box>

</brls:Box>
11 changes: 11 additions & 0 deletions source/calculatorTab.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <calculatorTab.hpp>

CalculatorTab::CalculatorTab()
{
this->inflateFromXMLRes("xml/tabs/calculator.xml");
}

brls::View* CalculatorTab::create()
{
return new CalculatorTab();
}
18 changes: 15 additions & 3 deletions source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
#include <borealis.hpp>

#include <vector>
#include <stdlib.h>
#include <calculatorTab.hpp>
#include <mainActivity.hpp>

#include <calculator.hpp>
using namespace brls::literals;

int main(int argc, char *argv[])
{
if (!brls::Application::init())
{
brls::Logger::error("Unable to init Borealis application");
return EXIT_FAILURE;
}
brls::Application::createWindow("Calculator_NX rewrite");
brls::Application::setGlobalQuit(true);

brls::Application::registerXMLView("CalculatorTab", CalculatorTab::create);
brls::Application::pushActivity(new MainActivity());

while (brls::Application::mainLoop());

return EXIT_SUCCESS;
}
1 change: 1 addition & 0 deletions source/mainActivity.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <mainActivity.hpp>

0 comments on commit 0073030

Please sign in to comment.