1 /*
2  * This source file is part of libRocket, the HTML/CSS Interface Middleware
3  *
4  * For the latest information, see http://www.librocket.com
5  *
6  * Copyright (c) 2014, David Wimsey
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  *
26  */
27 
28 #ifndef ROCKETSHELLRENDERINTERFACE_H
29 #define ROCKETSHELLRENDERINTERFACE_H
30 
31 /**
32 	Extensions to the RenderInterface class used by the Samples Shell to
33  	handle various bits of rendering and rendering upkeep that would normally
34  	be handled by the application rather than the libRocket RenderInterface class.
35 	@author David Wimsey
36  */
37 
38 class ShellRenderInterfaceExtensions
39 {
40 public:
41     /**
42      * @param[in] width width of viewport
43      * @param[in] height height of viewport
44 	 */
45     virtual void SetViewport(int width, int height) = 0;
46 
47     /**
48 	 * @param[in] context Rocket::Core::Context to set dimensions on when SetViewport is called
49      */
50     virtual void SetContext(void *context) = 0;
51 
52 	/// Attach the internal window buffer to a native window
53 	/// @param[in] nativeWindow A handle to the OS specific native window handle
54 	virtual bool AttachToNative(void *nativeWindow) = 0;
55 
56 	/// Detach and cleanup the internal window buffer from a native window
57 	virtual void DetachFromNative(void) = 0;
58 
59 	/// Prepares the render buffer for drawing, in OpenGL, this would call glClear();
60 	virtual void PrepareRenderBuffer(void) = 0;
61 
62 	/// Presents the rendered framebuffer to the screen, in OpenGL this would cal glSwapBuffers();
63 	virtual void PresentRenderBuffer(void) = 0;
64 };
65 
66 #endif
67