first commit

This commit is contained in:
Sylvain PILLOT 2022-02-28 20:28:13 +01:00
commit c469b5ea2a
7 changed files with 112 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Build files
/build-fx
/build-cg
/*.g1a
/*.g3a
# Python bytecode
__pycache__/
# Common IDE files
*.sublime-project
*.sublime-workspace
.vscode

32
CMakeLists.txt Normal file
View File

@ -0,0 +1,32 @@
# Configure with [fxsdk build-fx] or [fxsdk build-cg], which provide the
# toolchain file and module path of the fxSDK
cmake_minimum_required(VERSION 3.15)
project(MyAddin)
include(GenerateG3A)
include(Fxconv)
find_package(Gint 2.1 REQUIRED)
set(SOURCES
src/main.cc
# ...
)
set(ASSETS_cg
assets-cg/example.png
# ...
)
fxconv_declare_assets(${ASSETS_cg} WITH_METADATA)
add_executable(myaddin ${SOURCES} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -std=c++11 -c)
#target_compile_options(myaddin PRIVATE -Os -mb -m4a-nofpu -mhitachi -std=c++14 -fno-strict-aliasing -ffreestanding -fexceptions)
target_link_libraries(myaddin Gint::Gint -lustl -lc)
target_link_options(myaddin PRIVATE -Wl,-Map=map)
if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
generate_g3a(TARGET myaddin OUTPUT "TestuSTL.g3a"
NAME "uSTL Test" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()

0
README.md Normal file
View File

View File

@ -0,0 +1,3 @@
example.png:
type: bopti-image
name: img_example

BIN
assets-cg/icon-sel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
assets-cg/icon-uns.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

64
src/main.cc Normal file
View File

@ -0,0 +1,64 @@
#include <gint/display.h>
#include <gint/keyboard.h>
#include <vector>
#include <list>
#include <string>
#include <array>
#define std ustl
int main(void)
{
std::vector<int> v;
v.push_back(10);
v.push_back(20);
v.push_back(30);
v.push_back(40);
auto it = v.emplace( v.begin(), -10 );
v.emplace( it+1, 0 );
std::list<int> l;
l.push_back(100);
l.push_back(200);
l.push_back(300);
l.push_back(400);
l.push_front(0);
l.push_front(-100);
std::string s1("Hello");
std::string s2(" ");
std::string s3("World");
std::string s4=s1+s2+s3;
std::array<int, 5> a={-3, -2, -1, 0, 1};
dclear(C_WHITE);
dtext(1, 1, C_BLACK, "Sample fxSDK add-in.");
dtext(1, 25, C_RED, "Test std::vector");
for(int k=0; k<v.size(); k++)
dprint( 1, 40+k*10, C_RED, "v[%d] = %d",k,v[k]);
dtext(200, 25, C_GREEN, "Test std::list");
for(int k=0; k<l.size(); k++)
dprint( 200, 40+k*10, C_GREEN, "v[%d] = %d",k,l[k]);
dtext(1, 115, C_BLUE, "Test std::string");
dprint( 1, 130, C_BLUE, "%s + %s + %s = %s", s1.c_str(), s2.c_str(), s3.c_str(), s4.c_str());
dtext(1, 145, C_BLACK, "Test std::array" );
dprint( 1, 160, C_BLACK, "size= %d; front= %d; back= %d", a.size(), a.front(), a.back() );
int i=0;
for(int& k : a)
{
dprint( 1, 170+i*10, C_BLACK, "a[%d] = %d",i, k);
i++;
}
dupdate();
getkey();
return 1;
}