2010-02-18 03:21:18 +08:00
|
|
|
/*
|
|
|
|
* DSFML - SFML Library wrapper for the D programming language.
|
|
|
|
* Copyright (C) 2010 Andreas Hollandt
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or
|
|
|
|
* implied warranty. In no event will the authors be held
|
|
|
|
* liable for any damages arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
* including commercial applications, and to alter it and redistribute
|
|
|
|
* it freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented;
|
|
|
|
* you must not claim that you wrote the original software.
|
|
|
|
* If you use this software in a product, an acknowledgment
|
|
|
|
* in the product documentation would be appreciated but
|
|
|
|
* is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such,
|
|
|
|
* and must not be misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any
|
|
|
|
* source distribution.
|
2010-01-21 05:46:32 +08:00
|
|
|
*/
|
2010-02-18 03:21:18 +08:00
|
|
|
|
2010-01-21 05:46:32 +08:00
|
|
|
module dsfml.graphics.irendertarget;
|
|
|
|
|
|
|
|
import dsfml.system.vector2;
|
|
|
|
import dsfml.graphics.idrawable;
|
|
|
|
import dsfml.graphics.rect;
|
|
|
|
import dsfml.graphics.shader;
|
|
|
|
import dsfml.graphics.view;
|
|
|
|
import dsfml.graphics.color;
|
|
|
|
|
|
|
|
interface IRenderTarget
|
|
|
|
{
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Clear the entire target with a single color
|
|
|
|
*
|
|
|
|
* \param color : Color to use to clear the render target
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
void clear(Color color = Color());
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Draw something into the target
|
|
|
|
*
|
|
|
|
* \param object : Object to draw
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
void draw(IDrawable object);
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Draw something into the target with a shader
|
|
|
|
*
|
|
|
|
* \param object : Object to draw
|
|
|
|
* \param shader : Shader to apply
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
void draw(IDrawable object, Shader shader);
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Get the width of the rendering region of the target
|
|
|
|
*
|
|
|
|
* \return Width in pixels
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
uint getWidth();
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Get the height of the rendering region of the target
|
|
|
|
*
|
|
|
|
* \return Height in pixels
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
uint getHeight();
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Change the current active view.
|
|
|
|
*
|
|
|
|
* \param view : New view to use (pass GetDefaultView() to set the default view)
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
void setView(View view);
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Get the current view
|
|
|
|
*
|
|
|
|
* \return Current view active in the window
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
View getView();
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Get the default view of the window
|
|
|
|
*
|
|
|
|
* \return Default view
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
View getDefaultView();
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Get the viewport of a view applied to this target
|
|
|
|
*
|
|
|
|
* \param view Target view
|
|
|
|
*
|
|
|
|
* \return Viewport rectangle, expressed in pixels in the current target
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
IntRect getViewport(View view);
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Convert a point in target coordinates into view coordinates
|
|
|
|
*
|
|
|
|
* \param x : X coordinate of the point to convert, relative to the target
|
|
|
|
* \param y : Y coordinate of the point to convert, relative to the target
|
|
|
|
* \param view : Target view to convert the point to, null to use the currently associated view
|
|
|
|
*
|
|
|
|
* \return Converted point
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
Vector2f convertCoords(uint x, uint y, View view = null);
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Save the current OpenGL render states and matrices
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
void saveGLStates();
|
|
|
|
|
2010-02-18 03:21:18 +08:00
|
|
|
/**
|
2010-01-21 05:46:32 +08:00
|
|
|
* Restore the previously saved OpenGL render states and matrices
|
|
|
|
*
|
2010-02-18 03:21:18 +08:00
|
|
|
*/
|
2010-01-21 05:46:32 +08:00
|
|
|
void restoreGLStates();
|
|
|
|
}
|