summaryrefslogtreecommitdiff
path: root/Runtime/Graphics/DisplayManager.h
blob: 6de5f08d46bc9e721d230f6ecf83d90cfe2ef363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include "UnityPrefix.h"

// we do c-style interface, because display management is way too platfrom specific
// these function will be used from script
// UnityDisplayManager prefix is used because some platforms implements this in trampoline

#define SUPPORT_MULTIPLE_DISPLAYS UNITY_IPHONE

#if !SUPPORT_MULTIPLE_DISPLAYS
    #include "ScreenManager.h"
#endif

struct RenderSurfaceBase;

#if SUPPORT_MULTIPLE_DISPLAYS

    extern "C" int	UnityDisplayManager_DisplayCount();
    extern "C" bool	UnityDisplayManager_DisplayAvailable(void* nativeDisplay);
    extern "C" void	UnityDisplayManager_DisplaySystemResolution(void* nativeDisplay, int* w, int* h);
    extern "C" void	UnityDisplayManager_DisplayRenderingResolution(void* nativeDisplay, int* w, int* h);
    extern "C" void	UnityDisplayManager_DisplayRenderingBuffers(void* nativeDisplay, RenderSurfaceBase** colorBuffer, RenderSurfaceBase** depthBuffer);
    extern "C" void	UnityDisplayManager_SetRenderingResolution(void* nativeDisplay, int w, int h);

#else

    inline int  UnityDisplayManager_DisplayCount()
    {
        return 1;
    }
    inline bool UnityDisplayManager_DisplayAvailable(void*)
    {
        return true;
    }
    inline void UnityDisplayManager_DisplaySystemResolution(void*, int* w, int* h)
    {
        *w = GetScreenManager().GetWidth();
        *h = GetScreenManager().GetHeight();
    }
    inline void UnityDisplayManager_DisplayRenderingResolution(void*, int* w, int* h)
    {
        *w = GetScreenManager().GetWidth();
        *h = GetScreenManager().GetHeight();
    }
    inline void UnityDisplayManager_SetRenderingResolution(void*, int w, int h)
    {
        GetScreenManager().RequestResolution(w, h, GetScreenManager ().IsFullScreen (), 0);
    }
    inline void UnityDisplayManager_DisplayRenderingBuffers(void*, RenderSurfaceBase** color, RenderSurfaceBase** depth)
    {
        *color = *depth = 0;
    }

#endif