1
// Copyright (c) 2012- PPSSPP Project.
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
20
#include "base/functional.h"
21
#include "gfx_es2/glsl_program.h"
22
#include "Common/CommonWindows.h"
25
struct SimpleGLWindow {
26
static const PTCHAR windowClass;
29
FORMAT_565_REV = 0x00,
30
FORMAT_5551_REV = 0x01,
31
FORMAT_4444_REV = 0x02,
36
FORMAT_5551_BGRA_REV = 0x09,
37
FORMAT_4444_BGRA_REV = 0x0A,
38
FORMAT_8888_BGRA = 0x0B,
43
FORMAT_24BIT_8X = 0x13,
44
FORMAT_24X_8BIT = 0x14,
50
RESIZE_SHRINK_FIT = 0x01,
51
RESIZE_SHRINK_CENTER = 0x03,
56
SimpleGLWindow(HWND wnd);
60
void Draw(const u8 *data, int w, int h, bool flipped = false, Format = FORMAT_8888);
61
void Redraw(bool andSwap = true);
62
void Initialize(u32 flags);
63
static SimpleGLWindow *GetFrom(HWND hwnd);
64
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
66
// To draw something custom.
70
void SetFlags(u32 flags) {
87
return tw_ > 0 && th_ > 0;
98
void GetContentSize(float &x, float &y, float &fw, float &fh);
100
void SetHoverCallback(std::function<void(int, int)> hoverCallback) {
101
hoverCallback_ = hoverCallback;
104
static void RegisterClass();
107
void ResizeGL(int w, int h);
108
void CreateProgram();
109
void GenerateChecker();
111
bool DragStart(int mouseX, int mouseY);
112
bool DragContinue(int mouseX, int mouseY);
113
bool DragEnd(int mouseX, int mouseY);
114
bool Hover(int mouseX, int mouseY);
117
const u8 *Reformat(const u8 *data, Format fmt, u32 numPixels);
123
// Width and height of the window.
126
// Last texture size/flipped for Redraw().
131
GLSLProgram *drawProgram_;
135
// Disable shrink (toggled by double click.)
141
// Offset to position the texture is drawn at.
145
u32 reformatBufSize_;
147
std::function<void(int, int)> hoverCallback_;
b'\\ No newline at end of file'