Sha256: 7d0cd7e073fd07b74f7851bd6bf3e4023d0270cbfc1756ee97b5639d147daaf1

Contents?: true

Size: 1.64 KB

Versions: 29

Compression:

Stored size: 1.64 KB

Contents

#include <Gosu/Directories.hpp>
#include <Gosu/Utility.hpp>
#include <unistd.h>
#include "ruby.h"

extern "C" void Init_gosu();

/*#include "oniguruma.h"

extern "C" int rb_enc_register(const char *, OnigEncodingType*);
extern "C" void rb_encdb_declare(const char *name);
extern OnigEncodingType OnigEncodingASCII;
extern OnigEncodingType OnigEncodingUS_ASCII;
extern OnigEncodingType OnigEncodingUTF_8;
extern OnigEncodingType OnigEncodingUTF_16BE;
extern OnigEncodingType OnigEncodingUTF_16LE;
extern OnigEncodingType OnigEncodingUTF_32BE;
extern OnigEncodingType OnigEncodingUTF_32LE;*/

int main()
{
    std::string resourcePath = Gosu::wstringToUTF8(Gosu::resourcePrefix());
    chdir(resourcePath.c_str());

    std::string mainPath = resourcePath + "gosu/run.rb";

    char* argv[] = { "ruby", const_cast<char*>(mainPath.c_str()), 0 };
    int argc = 2;
    
    char** argvPointer = argv;
    ruby_sysinit(&argc, &argvPointer);
    { 
        RUBY_INIT_STACK; 
        
        ruby_init();
        
        Init_gosu();

        /*rb_encdb_declare(OnigEncodingASCII.name);
        rb_encdb_declare(OnigEncodingUS_ASCII.name);
        rb_encdb_declare(OnigEncodingUTF_8.name);
        rb_enc_register(OnigEncodingUTF_16BE.name, &OnigEncodingUTF_16BE);
        rb_enc_register(OnigEncodingUTF_16LE.name, &OnigEncodingUTF_16LE);
        rb_enc_register(OnigEncodingUTF_32BE.name, &OnigEncodingUTF_32BE);
        rb_enc_register(OnigEncodingUTF_32LE.name, &OnigEncodingUTF_32LE);*/

        rb_eval_string("$LOADED_FEATURES << 'gosu.bundle'");
        rb_eval_string("$LOADED_FEATURES << 'rubygems.rb'");

        return ruby_run_node(ruby_options(argc, argv)); 
    }
}

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
gosu-0.7.48 GosuImpl/RubyGosuStub.mm
gosu-0.7.47.1 GosuImpl/RubyGosuStub.mm
gosu-0.7.46 GosuImpl/RubyGosuStub.mm
gosu-0.7.45 GosuImpl/RubyGosuStub.mm
gosu-0.7.44 GosuImpl/RubyGosuStub.mm
gosu-0.7.43 GosuImpl/RubyGosuStub.mm
gosu-0.7.41 GosuImpl/RubyGosuStub.mm
gosu-0.7.40 GosuImpl/RubyGosuStub.mm
gosu-0.7.39 GosuImpl/RubyGosuStub.mm
gosu-0.7.38 GosuImpl/RubyGosuStub.mm
gosu-0.7.37 GosuImpl/RubyGosuStub.mm
gosu-0.7.36.2 GosuImpl/RubyGosuStub.mm
gosu-0.7.35 GosuImpl/RubyGosuStub.mm
gosu-0.7.33 GosuImpl/RubyGosuStub.mm
gosu-0.7.32 GosuImpl/RubyGosuStub.mm
gosu-0.7.31 GosuImpl/RubyGosuStub.mm
gosu-0.7.30 GosuImpl/RubyGosuStub.mm
gosu-0.7.29 GosuImpl/RubyGosuStub.mm
gosu-0.7.28 GosuImpl/RubyGosuStub.mm
gosu-0.7.27.1 GosuImpl/RubyGosuStub.mm