Skip to content

Commit df87b30

Browse files
committed
added more Gamebuino API + @unsigned helper + a project can be more than one file
1 parent 771aace commit df87b30

10 files changed

Lines changed: 391 additions & 105 deletions

File tree

‎boards/gamebuino.cpp‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#include "gamebuino.h"
22
#include <fmt/format.h>
33

4-
namespace fs = std::filesystem;
5-
using namespace std::string_literals;
6-
74
struct Resource
85
{
96
std::string filename;
@@ -29,7 +26,7 @@ void build_gamebuino(std::string project_name, std::vector<ClassFile> files)
2926

3027
for (auto & file : files)
3128
{
32-
file.generate(project_name);
29+
file.generate(files);
3330
}
3431

3532
std::ofstream output_header("gamebuino-java.h");
@@ -45,6 +42,7 @@ namespace gamebuino {
4542
4643
inline auto & display = ::gb.display;
4744
inline auto & buttons = ::gb.buttons;
45+
inline auto & frameCount = ::gb.frameCount;
4846
}
4947
5048
namespace Button {
@@ -64,7 +62,7 @@ namespace gamebuino {
6462

6563
if (resources.size())
6664
{
67-
std::ofstream output_res_header("resources.ino");
65+
std::ofstream output_res_header(RESOURCES_FILE);
6866

6967
for (auto & res : resources)
7068
{
@@ -80,13 +78,22 @@ namespace gamebuino {
8078
output_res_header.close();
8179
}
8280

83-
if (fs::exists(currentPath / "userdata.ino"))
81+
if (fs::exists(currentPath / RESOURCES_FILE))
82+
{
83+
fs::copy_file(currentPath / RESOURCES_FILE, fs::current_path() / RESOURCES_FILE, fs::copy_options::overwrite_existing);
84+
}
85+
else
86+
{
87+
fs::remove(fs::current_path() / RESOURCES_FILE);
88+
}
89+
90+
if (fs::exists(currentPath / USER_FILE))
8491
{
85-
fs::copy_file(currentPath / "userdata.ino", fs::current_path() / "userdata.ino", fs::copy_options::overwrite_existing);
92+
fs::copy_file(currentPath / USER_FILE, fs::current_path() / USER_FILE, fs::copy_options::overwrite_existing);
8693
}
8794
else
8895
{
89-
fs::remove(fs::current_path() / "userdata.ino");
96+
fs::remove(fs::current_path() / USER_FILE);
9097
}
9198

9299
fs::current_path(tempPath / project_name);

0 commit comments

Comments
 (0)