iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
IGraphics_include_in_plug_src.h
1/*
2 ==============================================================================
3
4 This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5
6 See LICENSE.txt for more info.
7
8 ==============================================================================
9*/
10
11#ifndef __IGRAPHICS_SRC_INC__
12#define __IGRAPHICS_SRC_INC__
13
20#include "IPlugPlatform.h"
21
22#ifndef NO_IGRAPHICS
23
24 #if defined OS_WEB
25
26 #include <emscripten.h>
27
28 iplug::igraphics::IGraphicsWeb* gGraphics = nullptr;
29
30 void StartMainLoopTimer()
31 {
32 iplug::igraphics::IGraphicsWeb* pGraphics = gGraphics;
33 emscripten_set_main_loop(pGraphics->OnMainLoopTimer, 0 /*pGraphics->FPS()*/, 1);
34 }
35
36 #elif defined OS_WIN
37 extern HINSTANCE gHINSTANCE;
38 #endif
39
40 BEGIN_IPLUG_NAMESPACE
41 BEGIN_IGRAPHICS_NAMESPACE
42
43 #if defined OS_WIN
44 IGraphics* MakeGraphics(IGEditorDelegate& dlg, int w, int h, int fps = 0, float scale = 1.)
45 {
46 IGraphicsWin* pGraphics = new IGraphicsWin(dlg, w, h, fps, scale);
47 pGraphics->SetWinModuleHandle(gHINSTANCE);
48 return pGraphics;
49 }
50 #elif defined OS_MAC
51 IGraphics* MakeGraphics(IGEditorDelegate& dlg, int w, int h, int fps = 0, float scale = 1.)
52 {
53 IGraphicsMac* pGraphics = new IGraphicsMac(dlg, w, h, fps, scale);
54 pGraphics->SetBundleID(BUNDLE_ID);
55 pGraphics->SetAppGroupID(APP_GROUP_ID);
56 pGraphics->SetSharedResourcesSubPath(SHARED_RESOURCES_SUBPATH);
57
58 return pGraphics;
59 }
60 #elif defined OS_IOS
61 IGraphics* MakeGraphics(IGEditorDelegate& dlg, int w, int h, int fps = 0, float scale = 1.)
62 {
63 IGraphicsIOS* pGraphics = new IGraphicsIOS(dlg, w, h, fps, scale);
64 pGraphics->SetBundleID(BUNDLE_ID);
65 pGraphics->SetAppGroupID(APP_GROUP_ID);
66
67 return pGraphics;
68 }
69 #elif defined OS_WEB
70 IGraphics* MakeGraphics(IGEditorDelegate& dlg, int w, int h, int fps = 0, float scale = 1.)
71 {
72 gGraphics = new IGraphicsWeb(dlg, w, h, fps, scale);
73 return gGraphics;
74 }
75 #else
76 #error "No OS defined!"
77 #endif
78
79 END_IGRAPHICS_NAMESPACE
80 END_IPLUG_NAMESPACE
81
82#endif //NO_IGRAPHICS
83
84#endif //__IGRAPHICS_SRC_INC__
Include to get consistently named preprocessor macros for different platforms and logging functionali...
An editor delegate base class for a SOMETHING that uses IGraphics for it's UI.
The lowest level base class of an IGraphics context.
Definition: IGraphics.h:86
IGraphics platform class for IOS.
Definition: IGraphicsIOS.h:25
IGraphics platform class for macOS.
Definition: IGraphicsMac.h:24
IGraphics platform class for the web.
Definition: IGraphicsWeb.h:44
IGraphics platform class for Windows.
Definition: IGraphicsWin.h:25