Use storybook namespace

This commit is contained in:
Dane Johnson 2022-01-02 19:35:30 -06:00
parent e6d5df0e6f
commit 13f4cc264a
12 changed files with 23 additions and 14 deletions

View File

@ -7,6 +7,7 @@
#define STATCHECK_GT 1 #define STATCHECK_GT 1
#define STATCHECK_LT 2 #define STATCHECK_LT 2
namespace storybook {
struct statcheck_t { struct statcheck_t {
char *stat; char *stat;
int value; int value;
@ -57,6 +58,7 @@ struct Page {
}; };
std::vector<Page*> CyoaParse(FILE *); std::vector<Page*> CyoaParse(FILE *);
}
#endif /* CYOA_H */ #endif /* CYOA_H */

View File

@ -5,6 +5,8 @@
#include <cassert> #include <cassert>
#include "cyoa.h" #include "cyoa.h"
using namespace storybook;
FILE* yyin = stdin; FILE* yyin = stdin;
#define YY_INPUT(buf, result, max_size) { \ #define YY_INPUT(buf, result, max_size) { \
@ -153,7 +155,7 @@ void append_body(Page *page, char *str) {
} }
} }
std::vector<Page*> CyoaParse(FILE *file) { std::vector<Page*> storybook::CyoaParse(FILE *file) {
yyin = file; yyin = file;
yyparse(); yyparse();
yyin = stdin; yyin = stdin;

View File

@ -4,6 +4,8 @@
#include "storybook.h" #include "storybook.h"
using namespace storybook;
Storybook::Storybook() { Storybook::Storybook() {
// TODO // TODO
} }

View File

@ -7,6 +7,8 @@
#include <cstdio> #include <cstdio>
#include "cyoa.h" #include "cyoa.h"
namespace storybook {
class Storybook { class Storybook {
private: private:
std::vector<Page*> pages; std::vector<Page*> pages;
@ -39,5 +41,5 @@ public:
} }
}; };
}; };
}
#endif /* STORYBOOK_H */ #endif /* STORYBOOK_H */

View File

@ -18,7 +18,7 @@ int main(int argc, const char *argv[]) {
fprintf(stderr, "Error: could not read %s", argv[1]); fprintf(stderr, "Error: could not read %s", argv[1]);
return 2; return 2;
} }
Storybook sb(fin); storybook::Storybook sb(fin);
fclose(fin); fclose(fin);
sb.Find("START"); sb.Find("START");

View File

@ -1,2 +1,3 @@
.sconsign.dblite .sconsign.dblite
bin/ bin/
*.os

View File

@ -12,7 +12,7 @@ opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x
opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx'])) opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bin/')) opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bin/'))
opts.Add(PathVariable('target_name', 'The library name.', 'libgdexample', PathVariable.PathAccept)) opts.Add(PathVariable('target_name', 'The library name.', 'libgdstorybook', PathVariable.PathAccept))
# Local dependency paths, adapt them to your setup # Local dependency paths, adapt them to your setup
godot_headers_path = "godot-cpp/godot-headers/" godot_headers_path = "godot-cpp/godot-headers/"

View File

@ -12,5 +12,5 @@ extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_opt
extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) { extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) {
godot::Godot::nativescript_init(handle); godot::Godot::nativescript_init(handle);
godot::register_class<godot::Story>(); godot::register_class<godot::Storybook>();
} }

Binary file not shown.

View File

@ -2,12 +2,12 @@
using namespace godot; using namespace godot;
void Story::_register_methods() { void Storybook::_register_methods() {
// TODO // TODO
// e.g. register_method("_process", &Story::_process); // e.g. register_method("_process", &Story::_process);
} }
Story::Story(){} Storybook::Storybook(){}
Story::~Story(){} Storybook::~Storybook(){}

View File

@ -7,14 +7,14 @@
#include <Sprite.hpp> #include <Sprite.hpp>
namespace godot { namespace godot {
class Story : public Node { class Storybook : public Node {
GODOT_CLASS(Story, Node) GODOT_CLASS(Storybook, Node)
private: private:
Storybook storybook; storybook::Storybook storybook;
public: public:
static void _register_methods(); static void _register_methods();
Story(); Storybook();
~Story(); ~Storybook();
void _init(); void _init();
}; };

Binary file not shown.