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_LT 2
namespace storybook {
struct statcheck_t {
char *stat;
int value;
@ -57,6 +58,7 @@ struct Page {
};
std::vector<Page*> CyoaParse(FILE *);
}
#endif /* CYOA_H */

View File

@ -5,6 +5,8 @@
#include <cassert>
#include "cyoa.h"
using namespace storybook;
FILE* yyin = stdin;
#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;
yyparse();
yyin = stdin;

View File

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

View File

@ -7,6 +7,8 @@
#include <cstdio>
#include "cyoa.h"
namespace storybook {
class Storybook {
private:
std::vector<Page*> pages;
@ -39,5 +41,5 @@ public:
}
};
};
}
#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]);
return 2;
}
Storybook sb(fin);
storybook::Storybook sb(fin);
fclose(fin);
sb.Find("START");

View File

@ -1,2 +1,3 @@
.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(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_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
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) {
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;
void Story::_register_methods() {
void Storybook::_register_methods() {
// TODO
// e.g. register_method("_process", &Story::_process);
}
Story::Story(){}
Story::~Story(){}
Storybook::Storybook(){}
Storybook::~Storybook(){}

View File

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

Binary file not shown.