File tree Expand file tree Collapse file tree 13 files changed +34
-33
lines changed
example_sdl2_sdlrenderer2
example_sdl3_sdlrenderer3 Expand file tree Collapse file tree 13 files changed +34
-33
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ Other Changes:
67
67
- Examples: SDL2+DirectX11: Try WARP software driver if hardware driver is
68
68
not available. (#5924, #5562)
69
69
- Examples: SDL3+DirectX11: Added SDL3+DirectX11 example. (#8956, #8957) [@tomaz82]
70
+ - Examples: made examples's main.cpp consistent with returning 1 on error.
70
71
71
72
72
73
-----------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ int main(int, char**)
39
39
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0 )
40
40
{
41
41
printf (" Error: %s\n " , SDL_GetError ());
42
- return - 1 ;
42
+ return 1 ;
43
43
}
44
44
45
45
// From 2.0.18: Enable native IME.
@@ -54,7 +54,7 @@ int main(int, char**)
54
54
if (window == nullptr )
55
55
{
56
56
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
57
- return - 1 ;
57
+ return 1 ;
58
58
}
59
59
60
60
SDL_SysWMinfo wmInfo;
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ int main(int, char**)
51
51
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0 )
52
52
{
53
53
printf (" Error: %s\n " , SDL_GetError ());
54
- return - 1 ;
54
+ return 1 ;
55
55
}
56
56
57
57
// Inform SDL that we will be using metal for rendering. Without this hint initialization of metal renderer may fail.
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ int main(int, char**)
31
31
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0 )
32
32
{
33
33
printf (" Error: %s\n " , SDL_GetError ());
34
- return - 1 ;
34
+ return 1 ;
35
35
}
36
36
37
37
// From 2.0.18: Enable native IME.
@@ -51,7 +51,7 @@ int main(int, char**)
51
51
if (window == nullptr )
52
52
{
53
53
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
54
- return - 1 ;
54
+ return 1 ;
55
55
}
56
56
57
57
SDL_GLContext gl_context = SDL_GL_CreateContext (window);
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ int main(int, char**)
36
36
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0 )
37
37
{
38
38
printf (" Error: %s\n " , SDL_GetError ());
39
- return - 1 ;
39
+ return 1 ;
40
40
}
41
41
42
42
// Decide GL+GLSL versions
@@ -85,14 +85,14 @@ int main(int, char**)
85
85
if (window == nullptr )
86
86
{
87
87
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
88
- return - 1 ;
88
+ return 1 ;
89
89
}
90
90
91
91
SDL_GLContext gl_context = SDL_GL_CreateContext (window);
92
92
if (gl_context == nullptr )
93
93
{
94
94
printf (" Error: SDL_GL_CreateContext(): %s\n " , SDL_GetError ());
95
- return - 1 ;
95
+ return 1 ;
96
96
}
97
97
98
98
SDL_GL_MakeCurrent (window, gl_context);
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ int main(int, char**)
33
33
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0 )
34
34
{
35
35
printf (" Error: %s\n " , SDL_GetError ());
36
- return - 1 ;
36
+ return 1 ;
37
37
}
38
38
39
39
// From 2.0.18: Enable native IME.
@@ -48,13 +48,13 @@ int main(int, char**)
48
48
if (window == nullptr )
49
49
{
50
50
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
51
- return - 1 ;
51
+ return 1 ;
52
52
}
53
53
SDL_Renderer* renderer = SDL_CreateRenderer (window, -1 , SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
54
54
if (renderer == nullptr )
55
55
{
56
56
SDL_Log (" Error creating SDL_Renderer!" );
57
- return - 1 ;
57
+ return 1 ;
58
58
}
59
59
// SDL_RendererInfo info;
60
60
// SDL_GetRendererInfo(renderer, &info);
Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ int main(int, char**)
349
349
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0 )
350
350
{
351
351
printf (" Error: %s\n " , SDL_GetError ());
352
- return - 1 ;
352
+ return 1 ;
353
353
}
354
354
355
355
// From 2.0.18: Enable native IME.
@@ -364,7 +364,7 @@ int main(int, char**)
364
364
if (window == nullptr )
365
365
{
366
366
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
367
- return - 1 ;
367
+ return 1 ;
368
368
}
369
369
370
370
ImVector<const char *> extensions;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ int main(int, char**)
34
34
if (!SDL_Init (SDL_INIT_VIDEO | SDL_INIT_GAMEPAD))
35
35
{
36
36
printf (" Error: SDL_Init(): %s\n " , SDL_GetError ());
37
- return - 1 ;
37
+ return 1 ;
38
38
}
39
39
40
40
// Setup window
@@ -44,7 +44,7 @@ int main(int, char**)
44
44
if (window == nullptr )
45
45
{
46
46
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
47
- return - 1 ;
47
+ return 1 ;
48
48
}
49
49
50
50
SDL_PropertiesID props = SDL_GetWindowProperties (window);
@@ -54,7 +54,7 @@ int main(int, char**)
54
54
if (!CreateDeviceD3D (hwnd))
55
55
{
56
56
CleanupDeviceD3D ();
57
- return - 1 ;
57
+ return 1 ;
58
58
}
59
59
60
60
SDL_SetWindowPosition (window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ int main(int, char**)
24
24
if (!SDL_Init (SDL_INIT_VIDEO | SDL_INIT_GAMEPAD))
25
25
{
26
26
printf (" Error: SDL_Init(): %s\n " , SDL_GetError ());
27
- return - 1 ;
27
+ return 1 ;
28
28
}
29
29
30
30
// Create SDL window graphics context
@@ -34,19 +34,19 @@ int main(int, char**)
34
34
if (window == nullptr )
35
35
{
36
36
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
37
- return - 1 ;
37
+ return 1 ;
38
38
}
39
39
SDL_SetWindowPosition (window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
40
40
SDL_ShowWindow (window);
41
41
42
42
// Create Metal device _before_ creating the view/layer
43
- id <MTLDevice > metalDevice = MTLCreateSystemDefaultDevice ();
43
+ id <MTLDevice > metalDevice = MTLCreateSystemDefaultDevice ();
44
44
if (!metalDevice)
45
45
{
46
46
printf (" Error: failed to create Metal device.\n " );
47
47
SDL_DestroyWindow (window);
48
48
SDL_Quit ();
49
- return - 1 ;
49
+ return 1 ;
50
50
}
51
51
SDL_MetalView view = SDL_Metal_CreateView (window);
52
52
CAMetalLayer * layer = (__bridge CAMetalLayer *)SDL_Metal_GetLayer (view);
@@ -128,7 +128,7 @@ int main(int, char**)
128
128
129
129
int width, height;
130
130
SDL_GetWindowSizeInPixels (window, &width, &height);
131
-
131
+
132
132
layer.drawableSize = CGSizeMake (width, height);
133
133
id <CAMetalDrawable > drawable = [layer nextDrawable ];
134
134
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ int main(int, char**)
30
30
if (!SDL_Init (SDL_INIT_VIDEO | SDL_INIT_GAMEPAD))
31
31
{
32
32
printf (" Error: SDL_Init(): %s\n " , SDL_GetError ());
33
- return - 1 ;
33
+ return 1 ;
34
34
}
35
35
36
36
// Decide GL+GLSL versions
@@ -74,13 +74,13 @@ int main(int, char**)
74
74
if (window == nullptr )
75
75
{
76
76
printf (" Error: SDL_CreateWindow(): %s\n " , SDL_GetError ());
77
- return - 1 ;
77
+ return 1 ;
78
78
}
79
79
SDL_GLContext gl_context = SDL_GL_CreateContext (window);
80
80
if (gl_context == nullptr )
81
81
{
82
82
printf (" Error: SDL_GL_CreateContext(): %s\n " , SDL_GetError ());
83
- return - 1 ;
83
+ return 1 ;
84
84
}
85
85
86
86
SDL_GL_MakeCurrent (window, gl_context);
You can’t perform that action at this time.
0 commit comments