Skip to content

Commit 8e19025

Browse files
author
Tiffany Bennett
committed
Successfully run on windows
1 parent ee43942 commit 8e19025

File tree

3 files changed

+9
-29
lines changed

3 files changed

+9
-29
lines changed

IntenseLogic

src/Demo.cpp

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -219,36 +219,13 @@ Window createWindow(const char *title, unsigned msaa)
219219
}
220220

221221
#ifdef _WIN32
222+
// hack to fix SDL
223+
FILE _iob[] = { *stdin, *stdout, *stderr };
222224

223-
int main(int argc, char **argv);
224-
225-
int CALLBACK WinMain(
226-
_In_ HINSTANCE hInstance,
227-
_In_ HINSTANCE hPrevInstance,
228-
_In_ LPSTR lpCmdLine,
229-
_In_ int nCmdShow)
225+
extern "C" FILE * __cdecl __iob_func(void)
230226
{
231-
LPWSTR lpwCmdLine = NULL;
232-
int len = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, lpCmdLine, -1, lpwCmdLine, 0);
233-
lpwCmdLine = new WCHAR[len];
234-
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, lpCmdLine, -1, lpwCmdLine, len);
235-
int argc;
236-
LPWSTR *argvw = CommandLineToArgvW(lpwCmdLine, &argc);
237-
delete[] lpwCmdLine;
238-
LPSTR *argv = new LPSTR[argc];
239-
for (int i = 0; i < argc; i++) {
240-
int len = WideCharToMultiByte(CP_UTF8, WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK | WC_DEFAULTCHAR, argvw[i], -1, argv[i], 0, NULL, NULL);
241-
argv[i] = new CHAR[len + 1];
242-
argv[i][len] = 0;
243-
WideCharToMultiByte(CP_UTF8, WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK | WC_DEFAULTCHAR, argvw[i], -1, argv[i], len, NULL, NULL);
244-
}
245-
LocalFree(argvw);
246-
main(argc, argv);
247-
for (int i = 0; i < argc; i++) {
248-
delete[] argv[i];
249-
}
227+
return _iob;
250228
}
251-
252229
#endif
253230

254231
ilA_fs demo_fs;

src/shadertoy/shadertoy.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ int main(int argc, char **argv)
9191

9292
ilA_adddir(&demo_fs, "shadertoys", -1);
9393
ilG_shaders_addPath("shadertoys");
94+
if (demo_shader.empty()) {
95+
fprintf(stderr, "Pass a shader with -f\n");
96+
return 1;
97+
}
9498
if (!ilA_fileopen(&ilG_shaders, &file, demo_shader.c_str(), -1)) {
9599
ilA_printerror(&file.err);
96100
return 1;
@@ -200,7 +204,6 @@ int main(int argc, char **argv)
200204
start_real = now;
201205
mono_start += float(delta.count() * speed);
202206
tf = mono_last = mono_start;
203-
printf("%f\n", tf);
204207
}
205208
shader.bind(s.first, s.second, tf, mouse);
206209

0 commit comments

Comments
 (0)