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

Side by Side Diff: nacltoons/src/main.cc

Issue 14851014: [nacltoons] Move nacl-specific build to proj.nacl (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « nacltoons/proj.win/nacltoons/nacltoons.vcxproj ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WIN32
6
7 #include "CCStdC.h"
8 #include "cocos2d.h"
9 #include "CCInstance.h"
10 #include "CCModule.h"
11
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <unistd.h>
15 #include <string>
16 #include <fcntl.h>
17 #include <sys/stat.h>
18 #include <AL/alc.h>
19
20 #include "app_delegate.h"
21
22 USING_NS_CC;
23 AppDelegate g_app;
24
25 void* cocos_main(void* arg) {
26 CocosPepperInstance* instance = (CocosPepperInstance*)arg;
27 fprintf(stderr, "in cocos_main\n");
28
29 // Any application that uses OpenAL on NaCl needs to call this
30 // before starting OpenAL.
31 alSetPpapiInfo(instance->pp_instance(),
32 pp::Module::Get()->get_browser_interface());
33
34 CCEGLView::g_instance = instance;
35 CCEGLView* eglView = CCEGLView::sharedOpenGLView();
36 fprintf(stderr, "calling setFrameSize\n");
37 eglView->setFrameSize(instance->Size().width(), instance->Size().height());
38 fprintf(stderr, "calling application->run\n");
39 int rtn = CCApplication::sharedApplication()->run();
40 fprintf(stderr, "app run returned: %d\n", rtn);
41 return NULL;
42 }
43
44 namespace pp {
45 Module* CreateModule() {
46 return new CocosPepperModule();
47 }
48 }
49
50 #else
51
52 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Window s headers
53 // Windows Header Files:
54 #include <windows.h>
55 #include <tchar.h>
56
57 // C RunTime Header Files
58 #include "CCStdC.h"
59
60
61 #include "app_delegate.h"
62 #include "CCEGLView.h"
63
64 USING_NS_CC;
65 AppDelegate g_app;
66
67 int APIENTRY _tWinMain(HINSTANCE hInstance,
68 HINSTANCE hPrevInstance,
69 LPTSTR lpCmdLine,
70 int nCmdShow)
71 {
72 UNREFERENCED_PARAMETER(hPrevInstance);
73 UNREFERENCED_PARAMETER(lpCmdLine);
74
75 // create the application instance
76 CCEGLView* eglView = CCEGLView::sharedOpenGLView();
77 eglView->setViewName("HelloCpp");
78 eglView->setFrameSize(2048, 1536);
79 // The resolution of ipad3 is very large. In general, PC's resolution is sma ller than it.
80 // So we need to invoke 'setFrameZoomFactor'(only valid on desktop(win32, ma c, linux)) to make the window smaller.
81 eglView->setFrameZoomFactor(0.4f);
82 return CCApplication::sharedApplication()->run();
83 }
84
85 #endif
OLDNEW
« no previous file with comments | « nacltoons/proj.win/nacltoons/nacltoons.vcxproj ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698