PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
validator/PlatformEnvironment.cpp
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: platforms/validator/PlatformEnvironment.cpp
4// Purpose: Validator Platform Environment Implementation
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2025 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9// This file is part of the PEBL project.
10//
11// PEBL is free software; you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation; either version 2 of the License, or
14// (at your option) any later version.
15//
16// PEBL is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with PEBL; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25#include "PlatformEnvironment.h"
26#include "../../base/PComplexData.h"
27#include "../../base/PList.h"
28
30 bool windowed, bool resizeable, bool unicode)
31 : mVideoMode(mode), mVideoDepth(depth), mWindowed(windowed),
32 mResizeable(resizeable), mUnicode(unicode), mNumJoysticks(0) {
33 __SetProps__();
34}
35
37}
38
40 // Minimal initialization - no SDL needed
41 mIsInitialized = true;
42}
43
45 // No-op: no actual rendering in validator mode
46 return true;
47}
48
50 // Return empty list - no screens in validator mode
51 PList* returnlist = new PList();
53 PComplexData* pcd = new PComplexData(tmp);
54 Variant tmp3 = Variant(pcd);
55 delete pcd;
56 return tmp3;
57}
58
59bool PlatformEnvironment::SetProperty(std::string name, Variant v) {
60 // Store property but don't do anything with it
61 return PEBLObjectBase::SetProperty(name, v);
62}
63
64Variant PlatformEnvironment::GetProperty(std::string name) const {
65 return PEBLObjectBase::GetProperty(name);
66}
67
69 // No-op: no cursor in validator mode
70 return 0;
71}
72
74 // No-op
75 return 0;
76}
77
79 // Return [0, 0] - no cursor position
80 PList* returnlist = new PList();
81 returnlist->PushBack(Variant(0));
82 returnlist->PushBack(Variant(0));
84 PComplexData* pcd = new PComplexData(tmp);
85 Variant tmp3 = Variant(pcd);
86 delete pcd;
87 return tmp3;
88}
89
90void PlatformEnvironment::SetKeyRepeat(bool onoff) {
91 // No-op
92}
93
95 // Return [0, 0, [0, 0, 0, 0, 0]] - no mouse state
96 PList* buttons = new PList();
97 for (int i = 0; i < 5; i++) {
98 buttons->PushBack(Variant(0));
99 }
101
102 PList* returnlist = new PList();
103 returnlist->PushBack(Variant(0)); // x
104 returnlist->PushBack(Variant(0)); // y
105 returnlist->PushBack(Variant(new PComplexData(tmpButtons))); // buttons
106
108 PComplexData* pcd = new PComplexData(tmp);
109 Variant tmp3 = Variant(pcd);
110 delete pcd;
111 return tmp3;
112}
113
115 return 0; // No joysticks in validator mode
116}
117
119 // Return null variant - no joysticks
120 return Variant();
121}
122
123std::ostream& PlatformEnvironment::SendToStream(std::ostream& out) const {
124 out << "PlatformEnvironment (validator)";
125 return out;
126}
127
128void PlatformEnvironment::__SetProps__() {
129 // Set object properties for introspection
130 SetProperty("VIDEOMODE", Variant((int)mVideoMode));
131 SetProperty("VIDEODEPTH", Variant((int)mVideoDepth));
132 SetProperty("WINDOWED", Variant(mWindowed));
133 SetProperty("RESIZEABLE", Variant(mResizeable));
134 SetProperty("UNICODE", Variant(mUnicode));
135}
PEBLVideoDepth
Definition Globals.h:69
PEBLVideoMode
Definition Globals.h:58
virtual bool SetProperty(std::string name, Variant v)
Variant GetProperty(std::string) const
bool mIsInitialized
Definition PList.h:45
void PushBack(const Variant &v)
Definition PList.cpp:149
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 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.
PlatformEnvironment(PEBLVideoMode mode, PEBLVideoDepth depth, bool windowed, bool resizeable, bool unicode)
Standard Constructor.
virtual Variant GetCursorPosition()