PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
sdl/PlatformEnvironment.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/platforms/sdl/PlatformEnvironment.h
4// Purpose: Contains platform-specific environment initiation
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2003-2026 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#ifndef __PLATFORMENVIRONMENT_H__
28#define __PLATFORMENVIRONMENT_H__
29
30//#include "PlatformWindow.h"
31
32
33#include "../../objects/PEnvironment.h"
34#include "../../apps/Globals.h"
35#include "../../base/PEBLObject.h"
36
37
38#ifdef PEBL_OSX
39#include "SDL.h"
40#include "SDL_ttf.h"
41#include "SDL_image.h"
42#elif defined(PEBL_EMSCRIPTEN)
43#include "SDL.h"
44#include "SDL_ttf.h"
45#include "SDL_image.h"
46#else
47#include "SDL.h"
48#include "SDL_ttf.h"
49#include "SDL_image.h"
50#endif
51
52#include <list>
53
54class PlatformWindow;
55
59
60
61class PlatformEnvironment: virtual public PEnvironment, public PEBLObjectBase
62{
63public:
64
66 bool windowed,bool resizeable, bool unicode);
67 virtual ~PlatformEnvironment();
68
69
70
72 void Initialize();
73
74 virtual bool Draw();
75 PEBLVideoMode GetVideoMode(){return mVideoMode;};
76 PEBLVideoDepth GetVideoDepth(){return mVideoDepth;};
77 bool GetWindowed(){return mWindowed;};
78
79 Variant GetScreenModes(int screen=-1);
80 Variant GetResizeable(){return mResizeable;};
81 //overloaded generic PEBLObjectBase methods
82 virtual bool SetProperty(std::string, Variant v);
83 virtual Variant GetProperty(std::string)const;
84// virtual ObjectValidationError ValidateProperty(std::string, Variant v)const;
85// virtual ObjectValidationError ValidateProperty(std::string)const;
86
87
88 virtual int ShowCursor(int val);
89 virtual int SetCursorPosition(int x, int y);
90 virtual Variant GetCursorPosition();
91 virtual void SetKeyRepeat(bool onoff);
92 virtual Variant GetMouseState(); //gets the buttons too!!!
93 virtual bool GetUnicode(){return mUnicode;};
94
95 virtual int GetNumJoysticks();
96 virtual Variant GetJoystick(int index);
97
98 // Platform-specific locale queries (uses SDL)
99 virtual std::string GetSystemLocale();
100 virtual bool IsSystemLocaleRTL();
101
102protected:
103 virtual std::ostream & SendToStream(std::ostream& out) const;
104
105private:
106
107 PEBLVideoMode mVideoMode;
108 PEBLVideoDepth mVideoDepth;
109
110 bool mWindowed;
111 bool mResizeable;
112 bool mUnicode;
113 int mNumJoysticks;
114
115 void __SetProps__();
116
117};
118
119
120
121#endif
PEBLVideoDepth
Definition Globals.h:69
PEBLVideoMode
Definition Globals.h:58
virtual bool SetProperty(std::string, Variant v)
virtual Variant GetJoystick(int index)
virtual ~PlatformEnvironment()
Standard Destructor.
virtual int SetCursorPosition(int x, int y)
virtual std::ostream & SendToStream(std::ostream &out) const
virtual std::string GetSystemLocale()
virtual void SetKeyRepeat(bool onoff)
Variant GetScreenModes(int screen=-1)
virtual int ShowCursor(int val)
virtual Variant GetProperty(std::string) const
void Initialize()
This method initiates everything needed to display the main window.
virtual Variant GetCursorPosition()