mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
graphicsdriver/metal: Bug fix: Failed to compile for iOS
The definition of BOOL is different between macOS and iOS. C's bool is used on iOS, but C's bool is hard to use from Go (e.g., an integer cannot be converted to C's bool). Use unsigned char instead. Fixes #1006
This commit is contained in:
parent
42056c2d61
commit
7991ba4cfa
@ -16,14 +16,13 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef signed char BOOL;
|
|
||||||
typedef unsigned long uint_t;
|
typedef unsigned long uint_t;
|
||||||
|
|
||||||
void *MakeMetalLayer();
|
void *MakeMetalLayer();
|
||||||
|
|
||||||
uint16_t MetalLayer_PixelFormat(void *metalLayer);
|
uint16_t MetalLayer_PixelFormat(void *metalLayer);
|
||||||
void MetalLayer_SetDevice(void *metalLayer, void *device);
|
void MetalLayer_SetDevice(void *metalLayer, void *device);
|
||||||
void MetalLayer_SetOpaque(void *metalLayer, BOOL opaque);
|
void MetalLayer_SetOpaque(void *metalLayer, unsigned char opaque);
|
||||||
const char *MetalLayer_SetPixelFormat(void *metalLayer, uint16_t pixelFormat);
|
const char *MetalLayer_SetPixelFormat(void *metalLayer, uint16_t pixelFormat);
|
||||||
const char *MetalLayer_SetMaximumDrawableCount(void *metalLayer,
|
const char *MetalLayer_SetMaximumDrawableCount(void *metalLayer,
|
||||||
uint_t maximumDrawableCount);
|
uint_t maximumDrawableCount);
|
||||||
|
@ -38,8 +38,8 @@ void MetalLayer_SetDevice(void *metalLayer, void *device) {
|
|||||||
((CAMetalLayer *)metalLayer).device = (id<MTLDevice>)device;
|
((CAMetalLayer *)metalLayer).device = (id<MTLDevice>)device;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetalLayer_SetOpaque(void *metalLayer, BOOL opaque) {
|
void MetalLayer_SetOpaque(void *metalLayer, unsigned char opaque) {
|
||||||
((CAMetalLayer *)metalLayer).opaque = opaque;
|
((CAMetalLayer *)metalLayer).opaque = (BOOL)opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *MetalLayer_SetPixelFormat(void *metalLayer, uint16_t pixelFormat) {
|
const char *MetalLayer_SetPixelFormat(void *metalLayer, uint16_t pixelFormat) {
|
||||||
|
@ -14,11 +14,7 @@
|
|||||||
|
|
||||||
// +build darwin
|
// +build darwin
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
typedef signed char BOOL;
|
|
||||||
|
|
||||||
void *Window_ContentView(void *window);
|
void *Window_ContentView(void *window);
|
||||||
|
|
||||||
void View_SetLayer(void *view, void *layer);
|
void View_SetLayer(void *view, void *layer);
|
||||||
void View_SetWantsLayer(void *view, BOOL wantsLayer);
|
void View_SetWantsLayer(void *view, unsigned char wantsLayer);
|
||||||
|
@ -25,6 +25,6 @@ void View_SetLayer(void *view, void *layer) {
|
|||||||
((NSView *)view).layer = (CALayer *)layer;
|
((NSView *)view).layer = (CALayer *)layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void View_SetWantsLayer(void *view, BOOL wantsLayer) {
|
void View_SetWantsLayer(void *view, unsigned char wantsLayer) {
|
||||||
((NSView *)view).wantsLayer = wantsLayer;
|
((NSView *)view).wantsLayer = (BOOL)wantsLayer;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user