MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
crossplatform.h
1 // © Copyright 2010 - 2014 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _crossplatform_h
41 #define _crossplatform_h
42 ///////////////////////////////////////////////////////////////////////////////
43 /// @namespace Mezzanine::crossplatform
44 /// @brief All functionality that needs different implemenations per platform will go in here
45 /// @details If we did our jobs right You not need to change anything to compile on
46 /// different platforms exvept the build target. If you want, the platform can
47 /// be manually defined in this section and this should be the only place that you
48 /// need to change to compile this on a supported platform. Just remark all the
49 /// lines that are not your platform using "//" and unremark your platform.
50 /// \n\n
51 /// Should you choose to port this to your platform, make sure that all the
52 /// required libraries are installed, then make sure to write an implementation
53 /// for each of the functions in crossplatform.cpp, then you should get to the
54 /// nitty gritty of making the minor platforms inconsistencies work.
55 /// \n\n
56 /// For most games there will be no need to directly call these functions, however if you decide
57 /// you game is an exception, there is one key thing to remember about all of these functions.
58 /// All of these may perform/behave slightly differently.
59 ///////////////////////////////////////////////////////////////////////////////
60 
61 /// @todo Make main page in documentation with wiki link and listing of required steps (build target and OS define), and dependencies required to build this.
62 
63 //Unremark one of these when not compiling with code::blocks or cmake
64 //#define LINUX
65 //#define MACOSX
66 //#define WINDOWS
67 
68 //End Choose Your Platform
69 ///////////////////////////////////////////////////////////////////////////////
70 
71 // Includes
72 #include "crossplatformexport.h"
73 #include "datatypes.h"
74 
75 // \internal
76 // Forward declaration for compatibility
77 namespace Ogre
78 {
79  class RenderWindow;
80 }
81 
82 struct SDL_Window;
83 
84 namespace Mezzanine
85 {
86  //Forward Declarations should go here
87  class Entresol;
88 
89  namespace crossplatform
90  {
91  /// @brief Gets the platform currently being run on.
92  /// @return Returns a string based on the platform. "Windows", "Linux", or "MacOSX".
94 
95  /// @brief Gets cleaned dimensions for a game window.
96  /// @param Width The desired width of the window area.
97  /// @param Height The desired height of the window area.
98  /// @param ActualWidth The modified value of the rendering width, after window decorations have been taken into account.
99  /// @param ActualHeight The modified value of the rendering height, after window decorations have been taken into account.
100  void MEZZ_LIB SanitizeWindowedRes(const Whole& Width, const Whole& Height, Whole& ActualWidth, Whole& ActualHeight);
101 
102  /// @brief Get a timestamp.
103  /// @warning On some platforms this requires a static initialization, an can cause undefined behavior if called before static initializations are complete
104  /// @return The largest size integer containing a timestamp that can be compared to other timestamps, but hads no guarantees for external value.
106 
107  #ifndef SWIG
108  /// @brief Get the resolution of the timestamp in microseconds.
109  /// @return A Whole which returns in millionths of a second the smallest unit of time that GetTimeStamp can measure.
111 
112  /// @brief Get the amount of logical processors, a reasononable amount to use for thread creation.
113  /// @details This returns whatever your OS thinks is the count of CPUs. This could include
114  /// Hyperthreading unit on Intel's chip, or it might not, it could include the threads from
115  /// Niagra CPUs or it might not, it could return just about any value on a given piece of
116  /// and should return a reasonable value for how many threads should be used.
117  /// @return A Whole containing the amount of processors.
119  #endif //SWIG
120  }// ©rossplatform
121 }//Mezzanine
122 
123 #endif