Monday 15 February 2010

ios - Embed SDL's view into UIViewController -



ios - Embed SDL's view into UIViewController -

some of sdl demo i've seen ios, rendering occurs within of sdl_window rather uiwindow. however, ios applications modeled based on 1 single uiwindow. integrate ios sdl , embed sdl's window (or sdl's view) within uiviewcontroller's view. how accomplished?

i've post questions here , see next comment michellec stating next don't know how code michellec mentioned. don't have permission post/reply on forum.

i pretty easy hold of sdl window , add together view controllers it, or encapsulated sdl view , add together view controller.

what i've done far modifying sdl_uikitviewcontroller.m reposition/resize sdl_window's view:

- (void)viewdidlayoutsubviews { cgrect newframe = self.view.frame; newframe.size.height = newframe.size.height - 100; newframe.size.width = newframe.size.width - 50; newframe.origin.x = 25.0f; self.view.frame = newframe; sdluikitdelegate *appdelegate = [sdluikitdelegate sharedappdelegate]; [appdelegate embedview:self.view]; }

i pass view function in sdl_uikitappdelegate.m add together sdl_window's view subview of uiviewcontroller. however, encountered error.

- (void) embedview:(uiview*)vw { [vw removefromsuperview]; cgrect frame = vw.frame; frame.origin.x = 56.0f; vw.frame = frame; [self.window.rootviewcontroller.view addsubview:vw]; } 2014-10-11 12:53:51.723 happy[16403:614428] -[sdluikitdelegate window]: unrecognized selector sent instance 0x7fbf11500d60 2014-10-11 12:53:51.725 happy[16403:614428] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[sdluikitdelegate window]: unrecognized selector sent instance 0x7fbf11500d60' *** first throw phone call stack: ( 0 corefoundation 0x00000001115323f5 __exceptionpreprocess + 165 1 libobjc.a.dylib 0x0000000111e04bb7 objc_exception_throw + 45 2 corefoundation 0x000000011153950d -[nsobject(nsobject) doesnotrecognizeselector:] + 205 3 corefoundation 0x000000011149160f ___forwarding___ + 495 4 corefoundation 0x0000000111491398 _cf_forwarding_prep_0 + 120 5 happy 0x000000010f227eb1 -[sdluikitdelegate embedview:] + 289 6 happy 0x000000010f26f968 -[sdl_uikitviewcontroller viewdidlayoutsubviews] + 1400 7 uikit 0x000000010fcee1cc -[uiview(calayerdelegate) layoutsublayersoflayer:] + 572 8 quartzcore 0x0000000111284f98 -[calayer layoutsublayers] + 150 9 quartzcore 0x0000000111279bbe _zn2ca5layer16layout_if_neededepns_11transactione + 380 10 quartzcore 0x0000000111279a2e _zn2ca5layer28layout_and_display_if_neededepns_11transactione + 24 11 quartzcore 0x00000001111e7ade _zn2ca7context18commit_transactionepns_11transactione + 242 12 quartzcore 0x00000001111e8bea _zn2ca11transaction6commitev + 390 13 uikit 0x000000010fc8adb0 -[uiapplication _sendorderedoutcontextsandinvalidate:] + 99 14 uikit 0x000000010fc8ad2b orderoutcontextobservercallout + 34 15 corefoundation 0x0000000111467347 __cfrunloop_is_calling_out_to_an_observer_callback_function__ + 23 16 corefoundation 0x00000001114672a0 __cfrunloopdoobservers + 368 17 corefoundation 0x000000011145c9e4 cfrunlooprunspecific + 436 18 happy 0x000000010f223667 uikit_pumpevents + 71 19 happy 0x000000010f1b0b10 sdl_pumpevents + 48 20 happy 0x000000010f1b0b88 sdl_waiteventtimeout + 56 21 happy 0x000000010f1b0b4a sdl_pollevent + 26 22 happy 0x000000010f16d883 sdl_main + 195 23 happy 0x000000010f227d3e -[sdluikitdelegate postfinishlaunch] + 46 24 foundation 0x000000010f81ea75 __nsfiredelayedperform + 387 25 corefoundation 0x000000011149a4e4 __cfrunloop_is_calling_out_to_a_timer_callback_function__ + 20 26 corefoundation 0x000000011149a0a5 __cfrunloopdotimer + 1045 27 corefoundation 0x000000011145d3dd __cfrunlooprun + 1901 28 corefoundation 0x000000011145ca06 cfrunlooprunspecific + 470 29 graphicsservices 0x00000001130209f0 gseventrunmodal + 161 30 uikit 0x000000010fc75550 uiapplicationmain + 1282 31 happy 0x000000010f227608 main + 328 32 libdyld.dylib 0x00000001121c6145 start + 1 33 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating uncaught exception of type nsexception

the problem due code referencing bad variable. next line in embedview: should replaced instead:

[self.window.rootviewcontroller.view addsubview:vw];

with

[mywindow.rootviewcontroller.view addsubview:vw];

ios 3d sdl

No comments:

Post a Comment