From 08d4c32ad99b4220b092df5665ae5ce8dfbb12b6 Mon Sep 17 00:00:00 2001
From: StackZ <47382115+SuperSaiyajinStackZ@users.noreply.github.com>
Date: Wed, 13 Jan 2021 23:50:33 +0100
Subject: [PATCH] Add Screen class + structs.
---
include/font.hpp | 30 +++++++++++++++++++++++++--
include/graphics.hpp | 30 +++++++++++++++++++++++++--
include/image.hpp | 30 +++++++++++++++++++++++++--
include/screen.hpp | 40 ++++++++++++++++++++++++++++++++++++
include/sprite.hpp | 6 +++---
include/structs.hpp | 49 ++++++++++++++++++++++++++++++++++++++++++++
source/font.cpp | 26 +++++++++++++++++++++++
source/graphics.cpp | 26 +++++++++++++++++++++++
source/image.cpp | 26 +++++++++++++++++++++++
source/sprite.cpp | 26 +++++++++++++++++++++++
10 files changed, 280 insertions(+), 9 deletions(-)
create mode 100644 include/screen.hpp
create mode 100644 include/structs.hpp
diff --git a/include/font.hpp b/include/font.hpp
index 5f3955c..264c302 100644
--- a/include/font.hpp
+++ b/include/font.hpp
@@ -1,5 +1,31 @@
-#ifndef FONT_HPP
-#define FONT_HPP
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
+#ifndef _UNIVERSAL_CORE_FONT_HPP
+#define _UNIVERSAL_CORE_FONT_HPP
#include "sprite.hpp"
diff --git a/include/graphics.hpp b/include/graphics.hpp
index f153ad5..80e7ec6 100644
--- a/include/graphics.hpp
+++ b/include/graphics.hpp
@@ -1,5 +1,31 @@
-#ifndef GRAPHICS_HPP
-#define GRAPHICS_HPP
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
+#ifndef _UNIVERSAL_CORE_GRAPHICS_HPP
+#define _UNIVERSAL_CORE_GRAPHICS_HPP
#include "font.hpp"
#include "image.hpp"
diff --git a/include/image.hpp b/include/image.hpp
index cc757a7..54ced8a 100644
--- a/include/image.hpp
+++ b/include/image.hpp
@@ -1,5 +1,31 @@
-#ifndef IMAGE_HPP
-#define IMAGE_HPP
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
+#ifndef _UNIVERSAL_CORE_IMAGE_HPP
+#define _UNIVERSAL_CORE_IMAGE_HPP
#include
#include
diff --git a/include/screen.hpp b/include/screen.hpp
new file mode 100644
index 0000000..65b05ff
--- /dev/null
+++ b/include/screen.hpp
@@ -0,0 +1,40 @@
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2020-2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
+#ifndef _UNIVERSAL_CORE_SCREEN_HPP
+#define _UNIVERSAL_CORE_SCREEN_HPP
+
+#include
+#include
+
+class Screen {
+public:
+ virtual ~Screen() {}
+ virtual void Logic(u32 hDown, u32 hHeld, touchPosition touch) = 0;
+ virtual void Draw() const = 0;
+};
+
+#endif
\ No newline at end of file
diff --git a/include/sprite.hpp b/include/sprite.hpp
index 7cf9ca7..46a46ac 100644
--- a/include/sprite.hpp
+++ b/include/sprite.hpp
@@ -1,5 +1,5 @@
-#ifndef SPRITE_HPP
-#define SPRITE_HPP
+#ifndef _UNIVERSAL_CORE_SPRITE_HPP
+#define _UNIVERSAL_CORE_SPRITE_HPP
#include "image.hpp"
@@ -14,7 +14,7 @@ private:
int _x, _y, _priority, _id, _rotationIndex, _paletteAlpha, _width, _height, _rotation;
float _scaleX, _scaleY;
bool _visibility;
- u16* _gfx;
+ u16 *_gfx;
static bool _assigned[2][256];
diff --git a/include/structs.hpp b/include/structs.hpp
new file mode 100644
index 0000000..36d4790
--- /dev/null
+++ b/include/structs.hpp
@@ -0,0 +1,49 @@
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2020-2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
+#ifndef _UNIVERSAL_CORE_STRUCTS_HPP
+#define _UNIVERSAL_CORE_STRUCTS_HPP
+
+#include
+
+class Structs {
+public:
+ struct ButtonPos {
+ int x;
+ int y;
+ int w;
+ int h;
+ };
+
+ struct Key {
+ std::string character;
+ int x;
+ int y;
+ int w;
+ };
+};
+
+#endif
\ No newline at end of file
diff --git a/source/font.cpp b/source/font.cpp
index dbd388e..3e1c6e2 100644
--- a/source/font.cpp
+++ b/source/font.cpp
@@ -1,3 +1,29 @@
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
#include "font.hpp"
#include "tonccpy.h"
diff --git a/source/graphics.cpp b/source/graphics.cpp
index 09a3340..c4dfbd5 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -1,3 +1,29 @@
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
#include "graphics.hpp"
#include "tonccpy.h"
diff --git a/source/image.cpp b/source/image.cpp
index dead597..bca5381 100644
--- a/source/image.cpp
+++ b/source/image.cpp
@@ -1,3 +1,29 @@
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
#include "image.hpp"
#include "tonccpy.h"
diff --git a/source/sprite.cpp b/source/sprite.cpp
index 68fb7aa..1f1644c 100644
--- a/source/sprite.cpp
+++ b/source/sprite.cpp
@@ -1,3 +1,29 @@
+/*
+* This file is part of Universal-Core
+* Copyright (C) 2021 Universal-Team
+*
+* 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 .
+*
+* 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.
+*/
+
#include "sprite.hpp"
#include "tonccpy.h"