Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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 PPAPI_SIMPLE_PPAPI_SIMPLE_MAIN2D_H_ | |
| 6 #define PPAPI_SIMPLE_PPAPI_SIMPLE_MAIN2D_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_bool.h" | |
| 9 #include "ppapi/c/pp_resource.h" | |
| 10 #include "ppapi/c/pp_size.h" | |
| 11 | |
| 12 #include "ppapi_simple/ppapi_simple.h" | |
| 13 #include "ppapi_simple/ppapi_simple_main.h" | |
| 14 | |
| 15 EXTERN_C_BEGIN | |
| 16 | |
| 17 typedef struct { | |
| 18 struct PP_Size size_; | |
| 19 struct PP_Resource ctx_; | |
| 20 PP_Bool bound_; | |
| 21 PP_Bool fullscreen_; | |
| 22 } PS2DContext_t; | |
| 23 | |
| 24 | |
| 25 /** | |
| 26 * PSUpdate2DContext | |
| 27 * | |
| 28 * Processes view event to create and/or update a 2D view context. Returns | |
| 29 * true when the context has changed. | |
|
binji
2013/05/23 18:06:49
probably needs an example of how to use
| |
| 30 */ | |
| 31 bool PSUpdate2DContext(PSEvent* event, PS2DContext_t* context); | |
| 32 | |
| 33 /** | |
| 34 * PSEnableRender | |
| 35 * | |
| 36 * When enabled, closes the render loop and primes the pump by injecting the | |
| 37 * first message resulting in a RenderReady. When disabled, breaks the | |
| 38 * cycle by preventing a Swap or PostWork which would signal the next frame. | |
| 39 */ | |
| 40 void PSEnableRender(int enable); | |
| 41 | |
| 42 /** | |
| 43 * PSCreateMain2D | |
| 44 * | |
| 45 * Constructs an instance Instance2D and configures it to use the main, view | |
| 46 * and reander callbacks passed in via the PSMain2DCfg_t object. Typically | |
| 47 * this function does not need to be called directly, and instead is called | |
| 48 * via the macro bellow. | |
| 49 */ | |
| 50 void* PSCreateMain2D(PP_Instance inst, const char* argv[]); | |
| 51 | |
| 52 | |
| 53 /** | |
| 54 * PPAPI_SIMPLE_MAIN | |
|
binji
2013/05/23 18:06:49
MAIN2D
| |
| 55 * | |
| 56 * Constructs an instance using PSCreateMain, and configures the 'main' and | |
|
binji
2013/05/23 18:06:49
this comment is a dupe of the PP_SIMPLE_MAIN, prob
| |
| 57 * 'view' callbacks. Either main and/or view may be NULL. To use: | |
| 58 * | |
| 59 * int my_main(int argc, const char* argv[]) { | |
| 60 * ... some code ... | |
| 61 * } | |
| 62 * | |
| 63 * PPAPI_SIMPLE_MAIN(my_main, NULL); | |
| 64 * | |
| 65 * NOTE: The library provides a simple 2D and 3D interface as well, however | |
| 66 * those automatically manage the graphic contexts. To manage the graphics | |
| 67 * yourself, use this interface and construct the graphics contexts and swap | |
| 68 * screen buffers as appropriate. | |
| 69 */ | |
| 70 | |
| 71 #define PPAPI_SIMPLE_MAIN2D(main, view, rend, ...) \ | |
| 72 static PSMain2DCfg_t s_cfg = { main, view, rend }; \ | |
|
binji
2013/05/23 18:06:49
PSMain2DCfg_t doesn't seem to be defined
| |
| 73 PPAPI_USE_MAIN(PSCreateMain2D, &s_cfg, ##__VA_ARGS__) | |
| 74 | |
| 75 EXTERN_C_END | |
| 76 | |
| 77 #endif /* PPAPI_SIMPLE_PPAPI_SIMPLE_MAIN2D_H_ */ | |
| 78 | |
| OLD | NEW |