OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | |
5 #include "CCStdC.h" | 4 #include "CCStdC.h" |
6 #include "AppDelegate.h" | 5 #include "AppDelegate.h" |
7 #include "cocos2d.h" | 6 #include "cocos2d.h" |
8 #include "CCInstance.h" | 7 #include "CCInstance.h" |
9 #include "CCModule.h" | 8 #include "CCModule.h" |
10 | 9 |
11 #include <stdlib.h> | 10 #include <stdlib.h> |
12 #include <stdio.h> | 11 #include <stdio.h> |
13 #include <unistd.h> | 12 #include <unistd.h> |
14 #include <string> | 13 #include <string> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void* cocos_main(void* arg) { | 51 void* cocos_main(void* arg) { |
53 CocosPepperInstance* instance = (CocosPepperInstance*)arg; | 52 CocosPepperInstance* instance = (CocosPepperInstance*)arg; |
54 fprintf(stderr, "in cocos_main\n"); | 53 fprintf(stderr, "in cocos_main\n"); |
55 | 54 |
56 // Any application that uses OpenAL on NaCl needs to call this | 55 // Any application that uses OpenAL on NaCl needs to call this |
57 // before starting OpenAL. | 56 // before starting OpenAL. |
58 alSetPpapiInfo(instance->pp_instance(), | 57 alSetPpapiInfo(instance->pp_instance(), |
59 pp::Module::Get()->get_browser_interface()); | 58 pp::Module::Get()->get_browser_interface()); |
60 | 59 |
61 // TODO(sbc): remove this hack an replace with some kind of URL mount | 60 // TODO(sbc): remove this hack an replace with some kind of URL mount |
62 mkdir("hd", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); | |
63 mkdir("sd", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); | |
64 mkdir("fonts", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); | 61 mkdir("fonts", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); |
65 const char* filenames[] = { "fonts/Marker Felt.ttf" }; | 62 const char* filenames[] = { "fonts/Marker Felt.ttf", "blocks.png" }; |
66 | 63 |
67 downloadFiles(instance->m_runner, filenames, sizeof(filenames)/sizeof(char*)); | 64 downloadFiles(instance->m_runner, filenames, sizeof(filenames)/sizeof(char*)); |
68 | 65 |
69 CCEGLView::g_instance = instance; | 66 CCEGLView::g_instance = instance; |
70 CCEGLView* eglView = CCEGLView::sharedOpenGLView(); | 67 CCEGLView* eglView = CCEGLView::sharedOpenGLView(); |
71 fprintf(stderr, "calling setFrameSize\n"); | 68 fprintf(stderr, "calling setFrameSize\n"); |
72 eglView->setFrameSize(instance->Size().width(), instance->Size().height()); | 69 eglView->setFrameSize(instance->Size().width(), instance->Size().height()); |
73 fprintf(stderr, "calling application->run\n"); | 70 fprintf(stderr, "calling application->run\n"); |
74 int rtn = CCApplication::sharedApplication()->run(); | 71 int rtn = CCApplication::sharedApplication()->run(); |
75 fprintf(stderr, "app run returned: %d\n", rtn); | 72 fprintf(stderr, "app run returned: %d\n", rtn); |
76 return NULL; | 73 return NULL; |
77 } | 74 } |
78 | 75 |
79 namespace pp { | 76 namespace pp { |
80 Module* CreateModule() { | 77 Module* CreateModule() { |
81 return new CocosPepperModule(); | 78 return new CocosPepperModule(); |
82 } | 79 } |
83 } | 80 } |
OLD | NEW |