~ubuntu-branches/ubuntu/intrepid/enigma/intrepid

« back to all changes in this revision

Viewing changes to src/video.hh

  • Committer: Bazaar Package Importer
  • Author(s): Erich Schubert
  • Date: 2005-08-28 15:30:09 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050828153009-sky64kb6tcq37xt5
Tags: 0.92.1-1
* New upstream subversion checkout
* Remove menu.s3m, which we are allowed to distributed but not to modify
  also copyright notice is confusing... (Closes: #321669)
* Rebuild with new libzipios (Closes: #325405)
  I hope this works without a versioned build-dependency
* Added "enigma replaces enigma-data" for upgrades (Closes: #308558)
* Added notes about the fonts copyright.
* updated to policy 3.6.2.1 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2002,2003,2004,2005 Daniel Heck
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU General Public License
6
 
 * as published by the Free Software Foundation; either version 2
7
 
 * of the License, or (at your option) any later version.
8
 
 *
9
 
 * This program 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 along
15
 
 * with this program; if not, write to the Free Software Foundation, Inc.,
16
 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17
 
 *
18
 
 * $Id: video.hh,v 1.9 2004/03/21 17:31:47 dheck Exp $
19
 
 */
20
 
 
21
 
#ifndef VIDEO_HH_INCLUDED
22
 
#define VIDEO_HH_INCLUDED
23
 
 
24
 
#include <memory>
25
 
#include "SDL.h"
26
 
#include "px/pxfwd.hh"
27
 
#include "px/geom.hh"
28
 
 
29
 
namespace video
30
 
{
31
 
 
32
 
    enum VideoModes {
33
 
        VM_None     = -1,
34
 
        VM_640x480  = 0,
35
 
        VM_640x512  = 1,
36
 
        VM_800x600  = 2,
37
 
        VM_1024x768 = 3,
38
 
        VM_COUNT
39
 
    };
40
 
 
41
 
    struct VMInfo {
42
 
        int width, height;      // Screen width and height in pixels
43
 
        int tile_size;          // Tile size in pixels
44
 
        const char *name;       // Menu text 
45
 
        const char *initscript; // Lua initialization script
46
 
        const char *gfxdir;     // Directory that contains the graphics
47
 
        int thumbw, thumbh;     // Width and height of thumbnails
48
 
        const char *thumbsdir;  // Directory that contains the thumbnails
49
 
        px::Rect gamearea;
50
 
        px::Rect statusbararea;
51
 
        px::Rect sb_timearea;
52
 
        px::Rect sb_movesarea;
53
 
        px::Rect sb_itemarea;
54
 
        px::Rect sb_textarea;
55
 
        VideoModes  fallback_videomode;
56
 
        bool     available;     // Is this video mode available?
57
 
    };
58
 
 
59
 
    void Init();
60
 
    void Shutdown();
61
 
 
62
 
    void ChangeVideoMode();
63
 
    bool SetFullscreen(bool onoff);
64
 
 
65
 
    /*! Switch between windowed and fullscreen mode. Return true if
66
 
       fullscreen mode is active afterwards. */
67
 
    bool ToggleFullscreen();
68
 
 
69
 
    bool IsFullScreen();
70
 
 
71
 
    /*! Return information about arbitrary video mode. */
72
 
    const VMInfo *GetInfo (VideoModes vm);
73
 
 
74
 
    /*! Return information about current video mode. */
75
 
    const VMInfo *GetInfo ();
76
 
 
77
 
    bool ModeAvailable (VideoModes vm);
78
 
 
79
 
    //! Return the current video mode
80
 
    VideoModes GetVideoMode();
81
 
 
82
 
    /*! Return the number of bits per pixel in the current video
83
 
      mode. [currently always 16] */
84
 
    int GetColorDepth();
85
 
 
86
 
    px::Screen *GetScreen();
87
 
 
88
 
    /*! The backbuffer is surface that has the same size and pixel
89
 
      format as the screen.  This surface is used by ShowScreen() and
90
 
      FX_* functions below. */
91
 
    px::Surface *BackBuffer();
92
 
    
93
 
    /*! Update gamma correction using current options. */
94
 
    void UpdateGamma();
95
 
 
96
 
    void               SetCaption (const char *str);
97
 
    const std::string& GetCaption();
98
 
 
99
 
    /*! Take a screenshot and save it as a PNG to file FNAME. */
100
 
    void Screenshot (const std::string &fname);
101
 
 
102
 
/* -------------------- Input grabbing -------------------- */
103
 
 
104
 
    class TempInputGrab {
105
 
    public:
106
 
        TempInputGrab (bool onoff);
107
 
        ~TempInputGrab();
108
 
    private:
109
 
        bool old_onoff;
110
 
    };
111
 
 
112
 
    bool GetInputGrab();
113
 
    bool SetInputGrab (bool onoff);
114
 
 
115
 
/* -------------------- Mouse cursor -------------------- */
116
 
 
117
 
    void SetMouseCursor(px::Surface *s, int hotx, int hoty);
118
 
    void HideMouse();
119
 
    void ShowMouse();
120
 
    int Mousex();
121
 
    int Mousey();
122
 
 
123
 
/* -------------------- Visual effects -------------------- */
124
 
 
125
 
    class TransitionEffect {
126
 
    public:
127
 
        virtual ~TransitionEffect() {}
128
 
        virtual void tick (double dtime) = 0;
129
 
        virtual bool finished() const = 0;
130
 
    };
131
 
 
132
 
    enum FadeMode { FADEIN, FADEOUT };
133
 
    void FX_Fade (FadeMode mode);
134
 
    void FX_Fly (px::Surface *newscr, int originx, int originy);
135
 
 
136
 
    enum TransitionModes
137
 
    {
138
 
        TM_RANDOM,
139
 
        TM_FADEOUTIN,
140
 
        TM_SQUARES,
141
 
        TM_FLY_N, TM_FLY_S, TM_FLY_W, TM_FLY_E,
142
 
        TM_FLY_NW, TM_FLY_NE, TM_FLY_SE, TM_FLY_SW,
143
 
        TM_PUSH_RANDOM, TM_PUSH_N, TM_PUSH_S, TM_PUSH_W, TM_PUSH_E
144
 
    };
145
 
    void ShowScreen (TransitionModes tm, px::Surface *newscr);
146
 
 
147
 
    TransitionEffect *MakeEffect (TransitionModes tm, px::Surface *newscr);
148
 
}
149
 
 
150
 
#endif