NPAPI:Pepper: Difference between revisions

Jump to navigation Jump to search
2D device example
(Add 2D rendering details)
(2D device example)
Line 250: Line 250:
} NPDeviceContext2D;</pre>
} NPDeviceContext2D;</pre>


=== An Example ===
==== 2D Device Example ====


A video game looks abstractly like
<pre>/* Get the 2D device function pointers. */
<pre>
NPDevice* device2d = extensions->acquireDevice(npp, NPPepper2DDevice);
  ...
  while (true) {
    HandleEvents()
    Simulate(gettimeofday())
    Draw()
  }
  ...
</pre>


We propose that we continue to set graphics attributes through the existing NPN_GetValue/NPN_SetValue interfaces with some new variables TBD.
/* Create a context. there are currently no options
  in the 2D device to configure */
NPDeviceContext2DConfig config;
NPDeviceContext2D context;
device2d->initializeContext(npp, &config, &context);


There are four APIs that would be involved in supporting this from the browser.
/* Draw into the bits in context->region however you want. */
 
device2d->flushContext(npp, &context);</pre>


=== NPP_SetWindow and Windowless Plugins ===
=== NPP_SetWindow and Windowless Plugins ===
202

edits

Navigation menu