mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-05 21:27:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// Roblox.m
|
||||
// RobloxMobile
|
||||
//
|
||||
// Created by Ben Tkacheff on 1/30/13.
|
||||
// Copyright (c) 2013 ROBLOX. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MarshallerInterface.h"
|
||||
#include "FunctionMarshaller.h"
|
||||
#include "Roblox.h"
|
||||
|
||||
|
||||
@implementation FunctionMarshaller
|
||||
|
||||
@synthesize pClosure;
|
||||
|
||||
-(void) marshallFunction
|
||||
{
|
||||
RBX::FunctionMarshaller::handleAppEvent(pClosure);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
static NSString* kAppEventMode = @"RobloxAppEvent";
|
||||
static NSArray* kAppEventModeList = [NSArray arrayWithObjects:(NSString*)kCFRunLoopDefaultMode, kAppEventMode, nil];
|
||||
|
||||
void Roblox::sendAppEvent(void *pClosure)
|
||||
{
|
||||
RBX::CEvent *waitEvent = ((RBX::FunctionMarshaller::Closure *) pClosure)->waitEvent;
|
||||
BOOL waitFlag = (waitEvent == NULL);
|
||||
|
||||
FunctionMarshaller* controller = [[FunctionMarshaller alloc] init];
|
||||
controller->pClosure = pClosure;
|
||||
|
||||
[controller performSelectorOnMainThread:@selector(marshallFunction) withObject:nil waitUntilDone:waitFlag modes:kAppEventModeList];
|
||||
|
||||
if (waitEvent)
|
||||
{
|
||||
waitEvent->Wait();
|
||||
}
|
||||
}
|
||||
|
||||
void Roblox::postAppEvent(void *pClosure)
|
||||
{
|
||||
FunctionMarshaller* controller = [[FunctionMarshaller alloc] init];
|
||||
controller->pClosure = pClosure;
|
||||
|
||||
[controller performSelectorOnMainThread:@selector(marshallFunction) withObject:nil waitUntilDone:NO modes:kAppEventModeList];
|
||||
}
|
||||
|
||||
void Roblox::processAppEvents()
|
||||
{
|
||||
while (CFRunLoopRunInMode((CFStringRef)kAppEventMode, 0, true) == kCFRunLoopRunHandledSource)
|
||||
;
|
||||
}
|
||||
Reference in New Issue
Block a user