Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: third_party/go/src/golang.org/x/mobile/app/darwin_arm.m

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build darwin
6
7 #include "_cgo_export.h"
8 #include <pthread.h>
9 #include <stdio.h>
10 #include <sys/utsname.h>
11
12 #import <UIKit/UIKit.h>
13 #import <GLKit/GLKit.h>
14
15 struct utsname sysInfo;
16
17 @interface AppController : GLKViewController
18 @end
19
20 @interface AppDelegate : UIResponder<UIApplicationDelegate>
21 @property (strong, nonatomic) UIWindow *window;
22 @property (strong, nonatomic) AppController *controller;
23 @end
24
25 @implementation AppDelegate
26 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( NSDictionary *)launchOptions {
27 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bou nds]];
28 self.controller = [[AppController alloc] initWithNibName:nil bundle:nil] ;
29 self.window.rootViewController = self.controller;
30 [self.window makeKeyAndVisible];
31 return YES;
32 }
33 @end
34
35 @interface AppController ()
36 @property (strong, nonatomic) EAGLContext *context;
37 @end
38
39 @implementation AppController
40 - (void)viewDidLoad {
41 [super viewDidLoad];
42 self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLE S2];
43 GLKView *view = (GLKView *)self.view;
44 view.context = self.context;
45 view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
46
47 // TODO(crawshaw): set correct geometry.
48 //CGRect bounds = view.bounds;
49 //view.contentScaleFactor;
50 setGeom(300, 300);
51 }
52 - (void)update {
53 NSLog(@"AppController update");
54 drawgl((GoUintptr)self.context);
55 }
56 @end
57
58 void runApp(void) {
59 @autoreleasepool {
60 UIApplicationMain(0, nil, nil, NSStringFromClass([AppDelegate cl ass]));
61 }
62 }
63
64 void setContext(void* context) {
65 EAGLContext* ctx = (EAGLContext*)context;
66 if (![EAGLContext setCurrentContext:ctx]) {
67 // TODO(crawshaw): determine how terrible this is. Exit?
68 NSLog(@"failed to set current context");
69 }
70 }
71
72 uint64_t threadID() {
73 uint64_t id;
74 if (pthread_threadid_np(pthread_self(), &id)) {
75 abort();
76 }
77 return id;
78 }
OLDNEW
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/app/darwin_arm.go ('k') | third_party/go/src/golang.org/x/mobile/app/debug/fps.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698