Chromium Code Reviews| Index: native_client_sdk/src/libraries/ppapi_simple/ppapi_simple_main2d.h |
| diff --git a/native_client_sdk/src/libraries/ppapi_simple/ppapi_simple_main2d.h b/native_client_sdk/src/libraries/ppapi_simple/ppapi_simple_main2d.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f860874638980adb578251945d1868ef350f0618 |
| --- /dev/null |
| +++ b/native_client_sdk/src/libraries/ppapi_simple/ppapi_simple_main2d.h |
| @@ -0,0 +1,78 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_SIMPLE_PPAPI_SIMPLE_MAIN2D_H_ |
| +#define PPAPI_SIMPLE_PPAPI_SIMPLE_MAIN2D_H_ |
| + |
| +#include "ppapi/c/pp_bool.h" |
| +#include "ppapi/c/pp_resource.h" |
| +#include "ppapi/c/pp_size.h" |
| + |
| +#include "ppapi_simple/ppapi_simple.h" |
| +#include "ppapi_simple/ppapi_simple_main.h" |
| + |
| +EXTERN_C_BEGIN |
| + |
| +typedef struct { |
| + struct PP_Size size_; |
| + struct PP_Resource ctx_; |
| + PP_Bool bound_; |
| + PP_Bool fullscreen_; |
| +} PS2DContext_t; |
| + |
| + |
| +/** |
| + * PSUpdate2DContext |
| + * |
| + * Processes view event to create and/or update a 2D view context. Returns |
| + * true when the context has changed. |
|
binji
2013/05/23 18:06:49
probably needs an example of how to use
|
| + */ |
| +bool PSUpdate2DContext(PSEvent* event, PS2DContext_t* context); |
| + |
| +/** |
| + * PSEnableRender |
| + * |
| + * When enabled, closes the render loop and primes the pump by injecting the |
| + * first message resulting in a RenderReady. When disabled, breaks the |
| + * cycle by preventing a Swap or PostWork which would signal the next frame. |
| + */ |
| +void PSEnableRender(int enable); |
| + |
| +/** |
| + * PSCreateMain2D |
| + * |
| + * Constructs an instance Instance2D and configures it to use the main, view |
| + * and reander callbacks passed in via the PSMain2DCfg_t object. Typically |
| + * this function does not need to be called directly, and instead is called |
| + * via the macro bellow. |
| + */ |
| +void* PSCreateMain2D(PP_Instance inst, const char* argv[]); |
| + |
| + |
| +/** |
| + * PPAPI_SIMPLE_MAIN |
|
binji
2013/05/23 18:06:49
MAIN2D
|
| + * |
| + * 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
|
| + * 'view' callbacks. Either main and/or view may be NULL. To use: |
| + * |
| + * int my_main(int argc, const char* argv[]) { |
| + * ... some code ... |
| + * } |
| + * |
| + * PPAPI_SIMPLE_MAIN(my_main, NULL); |
| + * |
| + * NOTE: The library provides a simple 2D and 3D interface as well, however |
| + * those automatically manage the graphic contexts. To manage the graphics |
| + * yourself, use this interface and construct the graphics contexts and swap |
| + * screen buffers as appropriate. |
| + */ |
| + |
| +#define PPAPI_SIMPLE_MAIN2D(main, view, rend, ...) \ |
| + static PSMain2DCfg_t s_cfg = { main, view, rend }; \ |
|
binji
2013/05/23 18:06:49
PSMain2DCfg_t doesn't seem to be defined
|
| + PPAPI_USE_MAIN(PSCreateMain2D, &s_cfg, ##__VA_ARGS__) |
| + |
| +EXTERN_C_END |
| + |
| +#endif /* PPAPI_SIMPLE_PPAPI_SIMPLE_MAIN2D_H_ */ |
| + |