Debian Codegraph @

src/gui/render/renderDX9.h

raw
1 /**
2 * Furnace Tracker - multi-system chiptune tracker
3 * Copyright (C) 2021-2025 tildearrow and contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "../gui.h"
21 #ifdef INCLUDE_D3D9
22 #include <d3d9.h>
23 struct FurnaceGUIRenderDX9Private;
24 #else
25 typedef void IDirect3D9;
26 typedef void IDirect3DVertexBuffer9;
27 typedef void FurnaceGUIRenderDX9Private;
28 #endif
29
30 class FurnaceGUIRenderDX9: public FurnaceGUIRender {
31 IDirect3D9* iface;
32 IDirect3DDevice9* device;
33 FurnaceGUIRenderDX9Private* priv;
34 IDirect3DVertexBuffer9* wipeBuf;
35
36 int outW, outH, swapInterval;
37
38 bool dead, haveScene, supportsDynamicTex, supportsVSync, mustResize, squareTex, inScene;
39
40 // SHADERS //
41
42 int maxWidth, maxHeight;
43 String vendorName, deviceName, apiVersion;
44
45 public:
46 ImTextureID getTextureID(FurnaceGUITexture* which);
47 float getTextureU(FurnaceGUITexture* which);
48 float getTextureV(FurnaceGUITexture* which);
49 FurnaceGUITextureFormat getTextureFormat(FurnaceGUITexture* which);
50 bool isTextureValid(FurnaceGUITexture* which);
51 bool lockTexture(FurnaceGUITexture* which, void** data, int* pitch);
52 bool unlockTexture(FurnaceGUITexture* which);
53 bool updateTexture(FurnaceGUITexture* which, void* data, int pitch);
54 FurnaceGUITexture* createTexture(bool dynamic, int width, int height, bool interpolate=true, FurnaceGUITextureFormat format=GUI_TEXFORMAT_ABGR32);
55 bool destroyTexture(FurnaceGUITexture* which);
56 void setTextureBlendMode(FurnaceGUITexture* which, FurnaceGUIBlendMode mode);
57 void setBlendMode(FurnaceGUIBlendMode mode);
58 void resized(const SDL_Event& ev);
59 void clear(ImVec4 color);
60 void newFrame();
61 bool canVSync();
62 bool areTexturesSquare();
63 void renderGUI();
64 void wipe(float alpha);
65 void present();
66 bool getOutputSize(int& w, int& h);
67 int getWindowFlags();
68 int getMaxTextureWidth();
69 int getMaxTextureHeight();
70 unsigned int getTextureFormats();
71 const char* getBackendName();
72 const char* getVendorName();
73 const char* getDeviceName();
74 const char* getAPIVersion();
75 void setSwapInterval(int swapInterval);
76 void preInit(const DivConfig& conf);
77 bool init(SDL_Window* win, int swapInterval);
78 void initGUI(SDL_Window* win);
79 void quitGUI();
80 bool quit();
81 bool isDead();
82 FurnaceGUIRenderDX9():
83 iface(NULL),
84 device(NULL),
85 priv(NULL),
86 wipeBuf(NULL),
87 outW(0),
88 outH(0),
89 swapInterval(1),
90 dead(false),
91 haveScene(false),
92 supportsDynamicTex(false),
93 supportsVSync(false),
94 mustResize(false),
95 squareTex(false),
96 inScene(false),
97 maxWidth(8192),
98 maxHeight(8192) {
99 }
100 };