source: trunk/src/platform/nacl/nacl_instance.h @ 1439

Last change on this file since 1439 was 1439, checked in by sam, 8 years ago

nacl: preliminary gamepad support in the NaCl backend.

  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1// Copyright (c) 2011 The Native Client 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 EXAMPLES_TUMBLER_TUMBLER_H_
6#define EXAMPLES_TUMBLER_TUMBLER_H_
7
8#include <ppapi/cpp/instance.h>
9#include <ppapi/c/ppb_gamepad.h>
10
11#include "platform/nacl/opengl_context.h"
12#include "platform/nacl/opengl_context_ptrs.h"
13
14#include "input/input.h"
15
16namespace lol {
17
18class NaClInstance : public pp::Instance {
19 public:
20  explicit NaClInstance(PP_Instance instance);
21
22  // The dtor makes the 3D context current before deleting the cube view, then
23  // destroys the 3D context both in the module and in the browser.
24  virtual ~NaClInstance();
25
26  // Called by the browser when the NaCl module is loaded and all ready to go.
27  virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);
28
29  // Called whenever the in-browser window changes size.
30  virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip);
31
32  // Called by the browser to handle the postMessage() call in Javascript.
33  virtual void HandleMessage(const pp::Var& message);
34
35  // Bind and publish the module's methods to JavaScript.
36  //void InitializeMethods(ScriptingBridge* bridge);
37
38
39  // Called to draw the contents of the module's browser area.
40    virtual bool HandleInputEvent(const pp::InputEvent& event);
41
42    void DrawSelf();
43
44    SharedOpenGLContext opengl_context_;
45
46    ivec2 m_size;
47
48private:
49    static void TickCallback(void* data, int32_t result);
50
51    static void CallIntMainWrappers(int argc, char const* argn[]);
52    static void CallVoidMainWrappers(int argc, char const* argn[]);
53
54    static void RunMain(uint32_t argc, const char* argn[], const char* argv[]);
55
56    /* Gamepad support */
57    PPB_Gamepad const *m_pad_interface;
58    Array<Stick *> m_sticks;
59};
60
61}  // namespace lol
62
63#endif  // EXAMPLES_TUMBLER_TUMBLER_H_
Note: See TracBrowser for help on using the repository browser.