00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021
00022
00023 #ifndef H_SPK_SFML_GLOBAL
00024 #define H_SPK_SFML_GLOBAL
00025
00026 #include "RenderingAPIs/SFML/SPK_SFML_DEF.h"
00027 #include "Core/SPK_Vector3D.h"
00028 #include "Core/SPK_System.h"
00029 #include "Core/SPK_Transformable.h"
00030 #include "RenderingAPIs/SFML/SPK_SFMLRenderer.h"
00031
00032 namespace SPK
00033 {
00034 namespace SFML
00035 {
00041 enum CameraAnchor
00042 {
00043 CAMERA_CENTER = 0,
00044 CAMERA_LEFT = -1,
00045 CAMERA_RIGHT = 1,
00046 CAMERA_TOP = -1,
00047 CAMERA_BOTTOM = 1,
00048 };
00049
00060 inline Vector3D vectorSPK(sf::Vector2f& v)
00061 {
00062 return Vector3D(v.x,v.y);
00063 }
00064
00075 inline Vector3D vectorSPK(sf::Vector3f& v)
00076 {
00077 return Vector3D(v.x,v.y,v.z);
00078 }
00079
00095 inline sf::Vector2f vector2SFML(Vector3D& v,bool addZ = false)
00096 {
00097 return sf::Vector2f(v.x,v.y - (addZ ? SFMLRenderer::getZFactor() * v.z : 0.0f));
00098 }
00099
00110 inline sf::Vector3f vector3SFML(Vector3D& v)
00111 {
00112 return sf::Vector3f(v.x,v.y,v.z);
00113 }
00114
00138 inline void setCameraPosition(CameraAnchor anchorX = CAMERA_RIGHT,
00139 CameraAnchor anchorY = CAMERA_BOTTOM,
00140 float altitude = 10000.0f,
00141 float offset = 1000.0f)
00142 {
00143 System::setCameraPosition(Vector3D(anchorX * offset,anchorY * offset,altitude));
00144 }
00145
00152 inline void setMatrix(Transformable& transformable,const sf::Matrix3& matrix)
00153 {
00154 transformable.setTransform(matrix.Get4x4Elements());
00155 }
00156 }}
00157
00158 #endif