PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
SDLUtility.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/SDLUtility.h
4// Purpose: Contains miscellaneous utility functions.
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 __SDLUTILITY_H__
28#define __SDLUTILITY_H__
29
30
31#include "../../objects/PColor.h"
32#include "SDL.h"
33#include "PlatformWindow.h"
34
35
37
38
39namespace SDLUtility
40{
41
42
44 SDL_Color PColorToSDLColor(PColor pcolor);
45
47 PColor SDLColorToPColor(SDL_Color scolor);
48
50 void DrawPixel(SDL_Renderer *renderer, PlatformWidget*pwidget,int x, int y, PColor color);
51 void DrawLine(SDL_Renderer *renderer, PlatformWidget*pwidget,int x1, int y1, int x2, int y2, PColor color);
52
53 Uint32 GetPixel(SDL_Surface *surface, int x, int y);
54 PColor GetPixelColor(SDL_Surface *surface, int x, int y);
55
56
57 Uint32 GetPixel(SDL_Renderer *renderer, SDL_Texture * texture,int x, int y);
58 PColor GetPixelColor(SDL_Renderer *renderer,SDL_Texture*texture, int x, int y);
59
60 int WritePNG(SDL_Renderer * renderer, SDL_Rect * rect, const std::string fname);
61 // int WritePNG(SDL_Renderer * renderer, SDL_Rect * rect,const Variant fname);
62
64
65 void CopyToClipboard(std::string text);
67
68 int PopupErrorBox(PlatformWindow * pwindow,const char* message);
69
70 long double GetTimeHP();
71 Variant GetDriverList(bool printout=true);
72
73}
74
75
76#endif
These are SDL-specific utilities that don't fit into a single class very well.
Definition SDLUtility.h:40
Variant GetDriverList(bool printout=true)
PColor SDLColorToPColor(SDL_Color scolor)
This converts between an SDL Color and a PColor
Variant CopyFromClipboard()
int WritePNG(SDL_Renderer *renderer, SDL_Rect *rect, const std::string fname)
void CopyToClipboard(std::string text)
int PopupErrorBox(PlatformWindow *pwindow, const char *message)
SDL_Color PColorToSDLColor(PColor pcolor)
This converts between a PColor and an SDL color.
void DrawLine(SDL_Renderer *renderer, PlatformWidget *pwidget, int x1, int y1, int x2, int y2, PColor color)
This sets a pixel to be a certain color.
Variant GetCurrentScreenResolution()
void DrawPixel(SDL_Renderer *renderer, PlatformWidget *pwidget, int x, int y, PColor color)
This sets a pixel to be a certain color.
long double GetTimeHP()
PColor GetPixelColor(SDL_Surface *surface, int x, int y)
This extracts the color of a pixel.
Uint32 GetPixel(SDL_Surface *surface, int x, int y)