Sha256: 52479b232c77f6198f31c73cf13100a497188f6ff21e598df896cf0cd62fece2

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

#import <CRuby.h>
#import "RubyProcessing.h"
#include "../src/ios/view_controller.h"


static ReflexViewController* active_reflex_view_controller = nil;

static ReflexViewController*
ReflexViewController_create()
{
	return active_reflex_view_controller;
}

static void
ReflexViewController_show (UIViewController*, ReflexViewController*)
{
}


@implementation RubyProcessing

	+ (void) setup
	{
		static BOOL done = NO;
		if (done) return;
		done = YES;

		[CRuby addLibrary:@"RubyProcessing" bundle:[NSBundle bundleForClass:RubyProcessing.class]];

		ReflexViewController_set_create_fun(ReflexViewController_create);
		ReflexViewController_set_show_fun(ReflexViewController_show);
	}

	+ (void) start: (NSString*) path
	{
		[CRuby evaluate:[NSString stringWithFormat:@
			"raise 'already started' unless require 'processing'\n"
			"load '%@'\n"
			"PROCESSING_WINDOW.__send__ :end_draw\n"
			"PROCESSING_WINDOW.show",
			path
		]];
	}

	+ (void) setActiveReflexViewController: (id) reflexViewController
	{
		active_reflex_view_controller = reflexViewController;
	}

	+ (void) resetActiveReflexViewController
	{
		active_reflex_view_controller = nil;
	}

@end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
processing-0.5.2 src/RubyProcessing.mm
processing-0.5.1 src/RubyProcessing.mm
processing-0.5.0 src/RubyProcessing.mm