| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 4 |
| 5 #include <assert.h> | 5 #include <assert.h> |
| 6 #include <math.h> | 6 #include <math.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| 11 #include <sys/time.h> | 11 #include <sys/time.h> |
| 12 #include <unistd.h> | 12 #include <unistd.h> |
| 13 | 13 |
| 14 #include <ppapi/c/ppb_input_event.h> | 14 #include <ppapi/c/ppb_input_event.h> |
| 15 #include <ppapi/cpp/fullscreen.h> | 15 #include <ppapi/cpp/fullscreen.h> |
| 16 #include <ppapi/cpp/input_event.h> | 16 #include <ppapi/cpp/input_event.h> |
| 17 #include <ppapi/cpp/instance_handle.h> |
| 17 #include <ppapi/cpp/var.h> | 18 #include <ppapi/cpp/var.h> |
| 18 #include <ppapi/cpp/var_array.h> | 19 #include <ppapi/cpp/var_array.h> |
| 19 #include <ppapi/cpp/var_array_buffer.h> | 20 #include <ppapi/cpp/var_array_buffer.h> |
| 20 #include <ppapi/cpp/var_dictionary.h> | 21 #include <ppapi/cpp/var_dictionary.h> |
| 21 | 22 |
| 22 #include "ppapi_simple/ps.h" | 23 #include "ppapi_simple/ps.h" |
| 23 #include "ppapi_simple/ps_context_2d.h" | 24 #include "ppapi_simple/ps_context_2d.h" |
| 24 #include "ppapi_simple/ps_event.h" | 25 #include "ppapi_simple/ps_event.h" |
| 25 #include "ppapi_simple/ps_instance.h" | 26 #include "ppapi_simple/ps_instance.h" |
| 26 #include "ppapi_simple/ps_interface.h" | 27 #include "ppapi_simple/ps_interface.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 268 } |
| 268 | 269 |
| 269 case PP_INPUTEVENT_TYPE_TOUCHSTART: | 270 case PP_INPUTEVENT_TYPE_TOUCHSTART: |
| 270 case PP_INPUTEVENT_TYPE_TOUCHMOVE: { | 271 case PP_INPUTEVENT_TYPE_TOUCHMOVE: { |
| 271 pp::TouchInputEvent touches = pp::TouchInputEvent(event); | 272 pp::TouchInputEvent touches = pp::TouchInputEvent(event); |
| 272 ProcessTouchEvent(touches); | 273 ProcessTouchEvent(touches); |
| 273 break; | 274 break; |
| 274 } | 275 } |
| 275 | 276 |
| 276 case PP_INPUTEVENT_TYPE_KEYDOWN: { | 277 case PP_INPUTEVENT_TYPE_KEYDOWN: { |
| 277 pp::Fullscreen fullscreen(PSInstance::GetInstance()); | 278 pp::Fullscreen fullscreen((pp::InstanceHandle(PSGetInstanceId()))); |
| 278 bool isFullscreen = fullscreen.IsFullscreen(); | 279 bool isFullscreen = fullscreen.IsFullscreen(); |
| 279 fullscreen.SetFullscreen(!isFullscreen); | 280 fullscreen.SetFullscreen(!isFullscreen); |
| 280 break; | 281 break; |
| 281 } | 282 } |
| 282 | 283 |
| 283 default: | 284 default: |
| 284 break; | 285 break; |
| 285 } | 286 } |
| 286 break; // case PSE_INSTANCE_HANDLEINPUT | 287 break; // case PSE_INSTANCE_HANDLEINPUT |
| 287 } | 288 } |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 } | 516 } |
| 516 // Do simulation, render and present. | 517 // Do simulation, render and present. |
| 517 life.Update(); | 518 life.Update(); |
| 518 } | 519 } |
| 519 return 0; | 520 return 0; |
| 520 } | 521 } |
| 521 | 522 |
| 522 // Register the function to call once the Instance Object is initialized. | 523 // Register the function to call once the Instance Object is initialized. |
| 523 // see: pappi_simple/ps_main.h | 524 // see: pappi_simple/ps_main.h |
| 524 PPAPI_SIMPLE_REGISTER_MAIN(example_main); | 525 PPAPI_SIMPLE_REGISTER_MAIN(example_main); |
| OLD | NEW |