git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

Cocoa/GBViewGL.m

      1 #import "GBViewGL.h"
      2 #import "GBOpenGLView.h"
      3 
      4 @implementation GBViewGL
      5 
      6 - (void)createInternalView
      7 {
      8     NSOpenGLPixelFormatAttribute attrs[] =
      9     {
     10         NSOpenGLPFAOpenGLProfile,
     11         NSOpenGLProfileVersion3_2Core,
     12         0
     13     };
     14     
     15     NSOpenGLPixelFormat *pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
     16     
     17     assert(pf);
     18     
     19     NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pf shareContext:nil];
     20  
     21     self.internalView = [[GBOpenGLView alloc] initWithFrame:self.frame pixelFormat:pf];
     22     ((GBOpenGLView *)self.internalView).wantsBestResolutionOpenGLSurface = true;
     23     ((GBOpenGLView *)self.internalView).openGLContext = context;
     24 }
     25 
     26 - (void)flip
     27 {
     28     [super flip];
     29     dispatch_async(dispatch_get_main_queue(), ^{
     30         [self.internalView setNeedsDisplay:true];
     31         [self setNeedsDisplay:true];
     32     });
     33 }
     34 
     35 @end

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.