~ubuntu-branches/debian/wheezy/cegui-mk2/wheezy

« back to all changes in this revision

Viewing changes to Samples/common/include/CEGuiD3D9BaseApplication.h

  • Committer: Package Import Robot
  • Author(s): Muammar El Khatib
  • Date: 2011-10-13 12:43:12 UTC
  • mfrom: (10.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20111013124312-qch0o3fayloxgxu3
Tags: 0.7.5-7
Moved to unstable. (Closes: #645109)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***********************************************************************
 
2
    filename:   CEGuiD3D9BaseApplication.h
 
3
    created:    24/9/2004
 
4
    author:     Paul D Turner
 
5
*************************************************************************/
 
6
/***************************************************************************
 
7
 *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
 
8
 *
 
9
 *   Permission is hereby granted, free of charge, to any person obtaining
 
10
 *   a copy of this software and associated documentation files (the
 
11
 *   "Software"), to deal in the Software without restriction, including
 
12
 *   without limitation the rights to use, copy, modify, merge, publish,
 
13
 *   distribute, sublicense, and/or sell copies of the Software, and to
 
14
 *   permit persons to whom the Software is furnished to do so, subject to
 
15
 *   the following conditions:
 
16
 *
 
17
 *   The above copyright notice and this permission notice shall be
 
18
 *   included in all copies or substantial portions of the Software.
 
19
 *
 
20
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
21
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
22
 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
23
 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 
24
 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 
25
 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
26
 *   OTHER DEALINGS IN THE SOFTWARE.
 
27
 ***************************************************************************/
 
28
#ifndef _CEGuiD3D9BaseApplication_h_
 
29
#define _CEGuiD3D9BaseApplication_h_
 
30
 
 
31
#include "CEGuiBaseApplication.h"
 
32
#include "CEGUIGeometryBuffer.h"
 
33
 
 
34
#if defined( __WIN32__ ) || defined( _WIN32 )
 
35
#   define WIN32_LEAN_AND_MEAN
 
36
#   include <windows.h>
 
37
 
 
38
// undefine Microsoft macro evilness
 
39
#   undef min
 
40
#   undef max
 
41
#endif
 
42
 
 
43
//Updated for linking of static libs
 
44
#if defined(_WIN32)
 
45
#  pragma comment(lib, "d3d9.lib")
 
46
#  if defined(_DEBUG)
 
47
#       if defined(CEGUI_STATIC)
 
48
#          pragma comment(lib, "CEGUIDirect3D9Renderer_Static_d.lib")
 
49
#       else
 
50
#      pragma comment(lib, "CEGUIDirect3D9Renderer_d.lib")
 
51
#       endif
 
52
#  else
 
53
#       if defined(CEGUI_STATIC)
 
54
#          pragma comment(lib, "CEGUIDirect3D9Renderer_Static.lib")
 
55
#       else
 
56
#      pragma comment(lib, "CEGUIDirect3D9Renderer.lib")
 
57
#       endif
 
58
#  endif
 
59
#endif
 
60
 
 
61
 
 
62
struct CEGuiBaseApplicationImpl;
 
63
 
 
64
 
 
65
class CEGuiD3D9BaseApplication : public CEGuiBaseApplication
 
66
{
 
67
public:
 
68
    /*!
 
69
    \brief
 
70
        Constructor.
 
71
    */
 
72
    CEGuiD3D9BaseApplication();
 
73
 
 
74
 
 
75
    /*!
 
76
    \brief
 
77
        Destructor.
 
78
    */
 
79
    ~CEGuiD3D9BaseApplication();
 
80
 
 
81
    // Implementation of base class abstract methods.
 
82
    bool execute(CEGuiSample* sampleApp);
 
83
    void cleanup();
 
84
 
 
85
protected:
 
86
    /*************************************************************************
 
87
        Implementation Methods
 
88
    *************************************************************************/
 
89
    /*!
 
90
    \brief
 
91
        Initialises Direct3D system.
 
92
    */
 
93
    bool initialiseDirect3D(unsigned int width, unsigned int height, unsigned int adapter, bool windowed);
 
94
 
 
95
 
 
96
    /*!
 
97
    \brief
 
98
        Do reset of Direct3D device
 
99
 
 
100
    \return
 
101
        - true if the device was reset successfully
 
102
        - false if the device was not reset.
 
103
    */
 
104
    bool resetDirect3D(void);
 
105
 
 
106
    void doFPSUpdate(void);
 
107
 
 
108
    bool overlayHandler(const CEGUI::EventArgs& args);
 
109
 
 
110
    /*************************************************************************
 
111
        Data fields
 
112
    *************************************************************************/
 
113
    CEGuiBaseApplicationImpl* pimpl;;
 
114
 
 
115
    // counter used to track elapsed time (for time pulse injection)
 
116
    DWORD d_lastFrameTime;
 
117
    // FPS stuff
 
118
    DWORD d_fps_lastTime;
 
119
    int d_fps_frames;
 
120
    int d_fps_value;
 
121
    char d_fps_textbuff[16];
 
122
    CEGUI::GeometryBuffer* d_fps_geometry;
 
123
    CEGUI::GeometryBuffer* d_logo_geometry;
 
124
};
 
125
 
 
126
#endif  // end of guard _CEGuiD3D9BaseApplication_h_