Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- D:ruby_extendpronmake>irb
- irb(main):001:0> require 'pro1'
- => true
- irb(main):002:0> include Pro
- => Object
- irb(main):003:0> Pro::load
- => false
- irb(main):004:0>
- #include "windows.h"
- #include "ruby.h"
- #include "pro.h"
- #define _D(string) {OutputDebugString(string);}
- VALUE Pro;
- HINSTANCE hlibrary;
- void _textline(const char *s, int len)
- //************************************
- {
- _D(s);
- }
- static VALUE p_load(VALUE self )
- //******************************
- {
- return pro_load();
- }
- static VALUE p_init(VALUE self)
- //*****************************
- {
- _D("-> init");
- pro_set_textline_callback(_textline);
- pro_renderInit();
- }
- static VALUE p_parse(VALUE self, VALUE string_to_parse)
- //*****************************************************
- {
- _D(StringValuePtr(string_to_parse));
- return pro_parse(StringValuePtr(string_to_parse));
- }
- void proeventcallback(proRenderEventType type, proRenderEventData data)
- //************************************************************************
- {
- switch(type){
- case proRenderEventDone:
- _D("-> cleanup");
- pro_renderCleanUp();
- //if (vWindow)
- //{
- // SendMessage((HWND)NUM2INT(vWindow), WM_USER+2, 0, 0);
- //}
- }
- }
- static VALUE pro_render( VALUE self )
- //**********************************
- {
- _D("-> render");
- pro_set_renderevent_callback(proeventcallback);
- SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_ABOVE_NORMAL);
- pro_render(PRO_RENDERASYNC);
- return Qtrue;
- }
- void Init_pro1()
- //***************
- {
- pro = rb_define_module( "Pro" );
- rb_define_method(Pro, "load", p_load, 0);
- rb_define_method( Pro, "init_engine", p_init, 0 );
- rb_define_method(Pro, "parse", p_parse, 1);
- rb_define_method(Pro, "render", pr_render, 0);
- }
Add Comment
Please, Sign In to add comment