mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
Implement comment state tracking for Gfx_SetAlphaTest
This commit is contained in:
parent
7cfce0fb96
commit
fd1f6ef424
@ -447,7 +447,7 @@ void Gfx_SetAlphaBlending(cc_bool enabled) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
C3D_AlphaTest(enabled, GPU_GREATER, 0x7F);
|
C3D_AlphaTest(enabled, GPU_GREATER, 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,7 +691,7 @@ void Gfx_SetFaceCulling(cc_bool enabled) {
|
|||||||
static ID3D11SamplerState* ps_samplers[2];
|
static ID3D11SamplerState* ps_samplers[2];
|
||||||
static ID3D11PixelShader* ps_shaders[12];
|
static ID3D11PixelShader* ps_shaders[12];
|
||||||
static ID3D11Buffer* ps_cBuffer;
|
static ID3D11Buffer* ps_cBuffer;
|
||||||
static cc_bool ps_alphaTesting, ps_mipmaps;
|
static cc_bool ps_mipmaps;
|
||||||
static float ps_fogEnd, ps_fogDensity;
|
static float ps_fogEnd, ps_fogDensity;
|
||||||
static PackedCol ps_fogColor;
|
static PackedCol ps_fogColor;
|
||||||
static int ps_fogMode;
|
static int ps_fogMode;
|
||||||
@ -725,7 +725,7 @@ static void PS_CreateShaders(void) {
|
|||||||
|
|
||||||
static int PS_CalcShaderIndex(void) {
|
static int PS_CalcShaderIndex(void) {
|
||||||
int idx = gfx_format == VERTEX_FORMAT_COLOURED ? 0 : 1;
|
int idx = gfx_format == VERTEX_FORMAT_COLOURED ? 0 : 1;
|
||||||
if (ps_alphaTesting) idx += 2;
|
if (gfx_alphaTest) idx += 2;
|
||||||
|
|
||||||
if (gfx_fogEnabled) {
|
if (gfx_fogEnabled) {
|
||||||
// uncomment when it works
|
// uncomment when it works
|
||||||
@ -822,8 +822,7 @@ static void PS_Free(void) {
|
|||||||
PS_FreeConstants();
|
PS_FreeConstants();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
ps_alphaTesting = enabled;
|
|
||||||
PS_UpdateShader();
|
PS_UpdateShader();
|
||||||
}
|
}
|
||||||
// unnecessary? check if any performance is gained, probably irrelevant
|
// unnecessary? check if any performance is gained, probably irrelevant
|
||||||
|
@ -394,7 +394,7 @@ void Gfx_DisableMipmaps(void) {
|
|||||||
*-----------------------------------------------------State management----------------------------------------------------*
|
*-----------------------------------------------------State management----------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static D3DFOGMODE gfx_fogMode = D3DFOG_NONE;
|
static D3DFOGMODE gfx_fogMode = D3DFOG_NONE;
|
||||||
static cc_bool gfx_alphaTesting, gfx_alphaBlending;
|
static cc_bool gfx_alphaBlending;
|
||||||
static cc_bool gfx_depthTesting, gfx_depthWriting;
|
static cc_bool gfx_depthTesting, gfx_depthWriting;
|
||||||
static PackedCol gfx_clearColor, gfx_fogColor;
|
static PackedCol gfx_clearColor, gfx_fogColor;
|
||||||
static float gfx_fogEnd = -1.0f, gfx_fogDensity = -1.0f;
|
static float gfx_fogEnd = -1.0f, gfx_fogDensity = -1.0f;
|
||||||
@ -455,10 +455,7 @@ void Gfx_SetFogMode(FogFunc func) {
|
|||||||
IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, mode);
|
IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
if (gfx_alphaTesting == enabled) return;
|
|
||||||
gfx_alphaTesting = enabled;
|
|
||||||
|
|
||||||
if (Gfx.LostContext) return;
|
if (Gfx.LostContext) return;
|
||||||
IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, enabled);
|
IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, enabled);
|
||||||
}
|
}
|
||||||
@ -529,7 +526,7 @@ void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
|||||||
|
|
||||||
static void D3D9_RestoreRenderStates(void) {
|
static void D3D9_RestoreRenderStates(void) {
|
||||||
union IntAndFloat raw;
|
union IntAndFloat raw;
|
||||||
IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, gfx_alphaTesting);
|
IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, gfx_alphaTest);
|
||||||
IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHABLENDENABLE, gfx_alphaBlending);
|
IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHABLENDENABLE, gfx_alphaBlending);
|
||||||
|
|
||||||
IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, gfx_fogEnabled);
|
IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, gfx_fogEnabled);
|
||||||
|
@ -80,7 +80,7 @@ static void SetColorWrite(cc_bool r, cc_bool g, cc_bool b, cc_bool a) {
|
|||||||
void Gfx_SetDepthWrite(cc_bool enabled) { glDepthMask(enabled); }
|
void Gfx_SetDepthWrite(cc_bool enabled) { glDepthMask(enabled); }
|
||||||
void Gfx_SetDepthTest(cc_bool enabled) { gl_Toggle(GL_DEPTH_TEST); }
|
void Gfx_SetDepthTest(cc_bool enabled) { gl_Toggle(GL_DEPTH_TEST); }
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) { gl_Toggle(GL_ALPHA_TEST); }
|
static void SetAlphaTest(cc_bool enabled) { gl_Toggle(GL_ALPHA_TEST); }
|
||||||
|
|
||||||
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
||||||
// don't need a fake second pass in this case
|
// don't need a fake second pass in this case
|
||||||
|
@ -409,7 +409,7 @@ void Gfx_SetFogEnd(float value) {
|
|||||||
void Gfx_SetFogMode(FogFunc func) {
|
void Gfx_SetFogMode(FogFunc func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
GX_SetAlphaCompare(GX_GREATER, 127, GX_AOP_AND, GX_ALWAYS, 0);
|
GX_SetAlphaCompare(GX_GREATER, 127, GX_AOP_AND, GX_ALWAYS, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -534,7 +534,7 @@ void Gfx_SetFogMode(FogFunc func) {
|
|||||||
gfx_fogMode = func;
|
gfx_fogMode = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
if (enabled) { glEnable(GL_ALPHA_TEST); } else { glDisable(GL_ALPHA_TEST); }
|
if (enabled) { glEnable(GL_ALPHA_TEST); } else { glDisable(GL_ALPHA_TEST); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ void Gfx_SetDynamicVbData(GfxResourceID vb, void* vertices, int vCount) {
|
|||||||
|
|
||||||
/* cached uniforms (cached for multiple programs */
|
/* cached uniforms (cached for multiple programs */
|
||||||
static struct Matrix _view, _proj, _mvp;
|
static struct Matrix _view, _proj, _mvp;
|
||||||
static cc_bool gfx_alphaTest, gfx_texTransform;
|
static cc_bool gfx_texTransform;
|
||||||
static float _texX, _texY;
|
static float _texX, _texY;
|
||||||
static PackedCol gfx_fogColor;
|
static PackedCol gfx_fogColor;
|
||||||
static float gfx_fogEnd = -1.0f, gfx_fogDensity = -1.0f;
|
static float gfx_fogEnd = -1.0f, gfx_fogDensity = -1.0f;
|
||||||
@ -500,7 +500,7 @@ void Gfx_SetFogMode(FogFunc func) {
|
|||||||
SwitchProgram();
|
SwitchProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) { gfx_alphaTest = enabled; SwitchProgram(); }
|
static void SetAlphaTest(cc_bool enabled) { SwitchProgram(); }
|
||||||
|
|
||||||
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
||||||
cc_bool enabled = !depthOnly;
|
cc_bool enabled = !depthOnly;
|
||||||
|
@ -377,7 +377,7 @@ void Gfx_SetFogEnd(float value) {
|
|||||||
void Gfx_SetFogMode(FogFunc func) {
|
void Gfx_SetFogMode(FogFunc func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
if (enabled) { glEnable(GL_ALPHA_TEST); } else { glDisable(GL_ALPHA_TEST); }
|
if (enabled) { glEnable(GL_ALPHA_TEST); } else { glDisable(GL_ALPHA_TEST); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ void Gfx_SetFogEnd(float value) {
|
|||||||
void Gfx_SetFogMode(FogFunc func) {
|
void Gfx_SetFogMode(FogFunc func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
//glEnable(GL_ALPHA_TEST);
|
//glEnable(GL_ALPHA_TEST);
|
||||||
} else {
|
} else {
|
||||||
|
@ -288,7 +288,7 @@ void Gfx_SetFaceCulling(cc_bool enabled) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
||||||
|
@ -244,7 +244,6 @@ void Gfx_DisableMipmaps(void) { }
|
|||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static int clearR, clearG, clearB;
|
static int clearR, clearG, clearB;
|
||||||
static cc_bool gfx_alphaBlend;
|
static cc_bool gfx_alphaBlend;
|
||||||
static cc_bool gfx_alphaTest;
|
|
||||||
static cc_bool gfx_depthTest;
|
static cc_bool gfx_depthTest;
|
||||||
static cc_bool stateDirty;
|
static cc_bool stateDirty;
|
||||||
|
|
||||||
@ -274,9 +273,8 @@ void Gfx_SetFaceCulling(cc_bool enabled) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
gfx_alphaTest = enabled;
|
stateDirty = true;
|
||||||
stateDirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
||||||
|
@ -316,7 +316,7 @@ void Gfx_SetDepthTest(cc_bool enabled) {
|
|||||||
UpdateDepthState();
|
UpdateDepthState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
rsxSetAlphaTestEnable(context, enabled);
|
rsxSetAlphaTestEnable(context, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ void Gfx_SetFogMode(FogFunc func) {
|
|||||||
/* TODO: Implemen fake exp/exp2 fog */
|
/* TODO: Implemen fake exp/exp2 fog */
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) { GU_Toggle(GU_ALPHA_TEST); }
|
static void SetAlphaTest(cc_bool enabled) { GU_Toggle(GU_ALPHA_TEST); }
|
||||||
|
|
||||||
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
|
||||||
cc_bool enabled = !depthOnly;
|
cc_bool enabled = !depthOnly;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
// TODO track last frame used on
|
// TODO track last frame used on
|
||||||
static cc_bool gfx_depthOnly;
|
static cc_bool gfx_depthOnly;
|
||||||
static cc_bool gfx_alphaTesting, gfx_alphaBlending;
|
static cc_bool gfx_alphaBlending;
|
||||||
static int frontBufferIndex, backBufferIndex;
|
static int frontBufferIndex, backBufferIndex;
|
||||||
// Inspired from
|
// Inspired from
|
||||||
// https://github.com/xerpi/gxmfun/blob/master/source/main.c
|
// https://github.com/xerpi/gxmfun/blob/master/source/main.c
|
||||||
@ -246,7 +246,7 @@ static void FP_SwitchActive(void) {
|
|||||||
index += 1;
|
index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfx_alphaTesting) index += 2 * 3;
|
if (gfx_alphaTest) index += 2 * 3;
|
||||||
|
|
||||||
FragmentProgram* FP = &FP_list[index];
|
FragmentProgram* FP = &FP_list[index];
|
||||||
if (FP == FP_Active) return;
|
if (FP == FP_Active) return;
|
||||||
@ -964,8 +964,7 @@ void Gfx_SetFogMode(FogFunc func) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
gfx_alphaTesting = enabled;
|
|
||||||
FP_SwitchActive();
|
FP_SwitchActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ void Gfx_SetFaceCulling(cc_bool enabled) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
||||||
|
@ -11,7 +11,6 @@ static float vp_hwidth, vp_hheight;
|
|||||||
static int sc_maxX, sc_maxY;
|
static int sc_maxX, sc_maxY;
|
||||||
|
|
||||||
static cc_bool alphaBlending;
|
static cc_bool alphaBlending;
|
||||||
static cc_bool alphaTest;
|
|
||||||
|
|
||||||
static PackedCol* colorBuffer;
|
static PackedCol* colorBuffer;
|
||||||
static PackedCol clearColor;
|
static PackedCol clearColor;
|
||||||
@ -115,8 +114,8 @@ void Gfx_SetFaceCulling(cc_bool enabled) {
|
|||||||
faceCulling = enabled;
|
faceCulling = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
alphaTest = enabled;
|
/* Uses value from Gfx_SetAlphaTest */
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
void Gfx_SetAlphaBlending(cc_bool enabled) {
|
||||||
@ -401,7 +400,7 @@ static void DrawTriangle(Vector4 frag1, Vector4 frag2, Vector4 frag3,
|
|||||||
G = (G * A) / 255 + (dstG * (255 - A)) / 255;
|
G = (G * A) / 255 + (dstG * (255 - A)) / 255;
|
||||||
B = (B * A) / 255 + (dstB * (255 - A)) / 255;
|
B = (B * A) / 255 + (dstB * (255 - A)) / 255;
|
||||||
}
|
}
|
||||||
if (alphaTest && A < 0x80) continue;
|
if (gfx_alphaTest && A < 0x80) continue;
|
||||||
|
|
||||||
if (depthWrite) depthBuffer[index] = z;
|
if (depthWrite) depthBuffer[index] = z;
|
||||||
colorBuffer[index] = BitmapCol_Make(R, G, B, 0xFF);
|
colorBuffer[index] = BitmapCol_Make(R, G, B, 0xFF);
|
||||||
|
@ -177,7 +177,7 @@ void Gfx_SetFogMode(FogFunc func) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
GX2SetAlphaTest(enabled, GX2_COMPARE_FUNC_GEQUAL, 0.5f);
|
GX2SetAlphaTest(enabled, GX2_COMPARE_FUNC_GEQUAL, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ void Gfx_SetAlphaBlending(cc_bool enabled) {
|
|||||||
pb_end(p);
|
pb_end(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
uint32_t* p = pb_begin();
|
uint32_t* p = pb_begin();
|
||||||
p = pb_push1(p, NV097_SET_ALPHA_TEST_ENABLE, enabled);
|
p = pb_push1(p, NV097_SET_ALPHA_TEST_ENABLE, enabled);
|
||||||
pb_end(p);
|
pb_end(p);
|
||||||
|
@ -155,7 +155,7 @@ void Gfx_SetFogMode(FogFunc func) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetAlphaTest(cc_bool enabled) {
|
static void SetAlphaTest(cc_bool enabled) {
|
||||||
Xe_SetAlphaTestEnable(xe, enabled);
|
Xe_SetAlphaTestEnable(xe, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,15 @@ static float gfx_minFrameMs;
|
|||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
static cc_bool gfx_colorMask[4] = { true, true, true, true };
|
static cc_bool gfx_colorMask[4] = { true, true, true, true };
|
||||||
cc_bool Gfx_GetFog(void) { return gfx_fogEnabled; }
|
cc_bool Gfx_GetFog(void) { return gfx_fogEnabled; }
|
||||||
|
static cc_bool gfx_alphaTest;
|
||||||
|
|
||||||
|
static void SetAlphaTest(cc_bool enabled);
|
||||||
|
void Gfx_SetAlphaTest(cc_bool enabled) {
|
||||||
|
if (gfx_alphaTest == enabled) return;
|
||||||
|
|
||||||
|
gfx_alphaTest = enabled;
|
||||||
|
SetAlphaTest(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialises/Restores render state */
|
/* Initialises/Restores render state */
|
||||||
CC_NOINLINE static void Gfx_RestoreState(void);
|
CC_NOINLINE static void Gfx_RestoreState(void);
|
||||||
|
@ -76,7 +76,7 @@ static UIInterfaceOrientationMask SupportedOrientations(void) {
|
|||||||
|
|
||||||
static cc_bool fullscreen = true;
|
static cc_bool fullscreen = true;
|
||||||
static void UpdateStatusBar(void) {
|
static void UpdateStatusBar(void) {
|
||||||
if (@available(iOS 10.7, *)) {
|
if ([cc_controller respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
|
||||||
// setNeedsStatusBarAppearanceUpdate - iOS 7.0
|
// setNeedsStatusBarAppearanceUpdate - iOS 7.0
|
||||||
[cc_controller setNeedsStatusBarAppearanceUpdate];
|
[cc_controller setNeedsStatusBarAppearanceUpdate];
|
||||||
} else {
|
} else {
|
||||||
@ -509,16 +509,16 @@ void ShowDialogCore(const char* title, const char* msg) {
|
|||||||
NSString* _msg = [NSString stringWithCString:msg encoding:NSASCIIStringEncoding];
|
NSString* _msg = [NSString stringWithCString:msg encoding:NSASCIIStringEncoding];
|
||||||
alert_completed = false;
|
alert_completed = false;
|
||||||
|
|
||||||
if (@available(iOS 10.8, *)) {
|
#ifdef TARGET_OS_TV
|
||||||
UIAlertController* alert = [UIAlertController alertControllerWithTitle:_title message:_msg preferredStyle:UIAlertControllerStyleAlert];
|
UIAlertController* alert = [UIAlertController alertControllerWithTitle:_title message:_msg preferredStyle:UIAlertControllerStyleAlert];
|
||||||
UIAlertAction* okBtn = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* act) { alert_completed = true; }];
|
UIAlertAction* okBtn = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* act) { alert_completed = true; }];
|
||||||
[alert addAction:okBtn];
|
[alert addAction:okBtn];
|
||||||
[cc_controller presentViewController:alert animated:YES completion: Nil];
|
[cc_controller presentViewController:alert animated:YES completion: Nil];
|
||||||
} else {
|
#else
|
||||||
UIAlertView* alert = [UIAlertView alloc];
|
UIAlertView* alert = [UIAlertView alloc];
|
||||||
alert = [alert initWithTitle:_title message:_msg delegate:cc_controller cancelButtonTitle:@"OK" otherButtonTitles:nil];
|
alert = [alert initWithTitle:_title message:_msg delegate:cc_controller cancelButtonTitle:@"OK" otherButtonTitles:nil];
|
||||||
[alert show];
|
[alert show];
|
||||||
}
|
#endif
|
||||||
|
|
||||||
// TODO clicking outside message box crashes launcher
|
// TODO clicking outside message box crashes launcher
|
||||||
// loop until alert is closed TODO avoid sleeping
|
// loop until alert is closed TODO avoid sleeping
|
||||||
@ -651,18 +651,15 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
|
|||||||
if (utType) [types addObject:utType];
|
if (utType) [types addObject:utType];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@available(iOS 10.8, *)) {
|
UIDocumentPickerViewController* dlg;
|
||||||
UIDocumentPickerViewController* dlg;
|
dlg = [UIDocumentPickerViewController alloc];
|
||||||
dlg = [UIDocumentPickerViewController alloc];
|
dlg = [dlg initWithDocumentTypes:types inMode:UIDocumentPickerModeOpen];
|
||||||
dlg = [dlg initWithDocumentTypes:types inMode:UIDocumentPickerModeOpen];
|
//dlg = [dlg initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];
|
||||||
//dlg = [dlg initWithDocumentTypes:types inMode:UIDocumentPickerModeImport];
|
|
||||||
|
open_dlg_callback = args->Callback;
|
||||||
open_dlg_callback = args->Callback;
|
dlg.delegate = cc_controller;
|
||||||
dlg.delegate = cc_controller;
|
[cc_controller presentViewController:dlg animated:YES completion: Nil];
|
||||||
[cc_controller presentViewController:dlg animated:YES completion: Nil];
|
return 0; // TODO still unfinished
|
||||||
return 0; // TODO still unfinished
|
|
||||||
}
|
|
||||||
return ERR_NOT_SUPPORTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
||||||
@ -680,16 +677,13 @@ cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
|||||||
NSString* str = ToNSString(&save_path);
|
NSString* str = ToNSString(&save_path);
|
||||||
NSURL* url = [NSURL fileURLWithPath:str isDirectory:NO];
|
NSURL* url = [NSURL fileURLWithPath:str isDirectory:NO];
|
||||||
|
|
||||||
if (@available(iOS 10.8, *)) {
|
UIDocumentPickerViewController* dlg;
|
||||||
UIDocumentPickerViewController* dlg;
|
dlg = [UIDocumentPickerViewController alloc];
|
||||||
dlg = [UIDocumentPickerViewController alloc];
|
dlg = [dlg initWithURL:url inMode:UIDocumentPickerModeExportToService];
|
||||||
dlg = [dlg initWithURL:url inMode:UIDocumentPickerModeExportToService];
|
|
||||||
|
dlg.delegate = cc_controller;
|
||||||
dlg.delegate = cc_controller;
|
[cc_controller presentViewController:dlg animated:YES completion: Nil];
|
||||||
[cc_controller presentViewController:dlg animated:YES completion: Nil];
|
return 0;
|
||||||
return 0; // TODO still unfinished
|
|
||||||
}
|
|
||||||
return ERR_NOT_SUPPORTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1841,4 +1835,4 @@ void LBackend_CloseScreen(struct LScreen* s) {
|
|||||||
{
|
{
|
||||||
[view removeFromSuperview];
|
[view removeFromSuperview];
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user