iPlug2 - C++ Audio Plug-in Framework
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->SetSharedResourcesSubPath(SHARED_RESOURCES_SUBPATH);
56 
57  return pGraphics;
58  }
59  #elif defined OS_IOS
60  IGraphics* MakeGraphics(IGEditorDelegate& dlg, int w, int h, int fps = 0, float scale = 1.)
61  {
62  IGraphicsIOS* pGraphics = new IGraphicsIOS(dlg, w, h, fps, scale);
63  pGraphics->SetBundleID(BUNDLE_ID);
64 
65  return pGraphics;
66  }
67  #elif defined OS_WEB
68  IGraphics* MakeGraphics(IGEditorDelegate& dlg, int w, int h, int fps = 0, float scale = 1.)
69  {
70  gGraphics = new IGraphicsWeb(dlg, w, h, fps, scale);
71  return gGraphics;
72  }
73  #else
74  #error "No OS defined!"
75  #endif
76 
77  END_IGRAPHICS_NAMESPACE
78  END_IPLUG_NAMESPACE
79 
80 #endif //NO_IGRAPHICS
81 
82 #endif //__IGRAPHICS_SRC_INC__
IGraphics platform class for Windows.
Definition: IGraphicsWin.h:24
Include to get consistently named preprocessor macros for different platforms and logging functionali...
IGraphics platform class for macOS.
Definition: IGraphicsMac.h:23
An editor delegate base class for a SOMETHING that uses IGraphics for it&#39;s UI.
IGraphics platform class for the web.
Definition: IGraphicsWeb.h:43
The lowest level base class of an IGraphics context.
Definition: IGraphics.h:86
IGraphics platform class for IOS.
Definition: IGraphicsIOS.h:24