Skip to content

Commit a56f176

Browse files
SDL2 document: a few minor changes
1 parent 2a38d40 commit a56f176

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

doc/SDL2.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Create GL Context if using OpenGL
3636
// Check if succeeded, etc.
3737
```
3838

39-
If necessary, get a handle to the platform's native window, then setting it in the Diligent NativeWindow struct. Example for Windows:
39+
If necessary, get a handle to the platform's native window, then set it in the Diligent NativeWindow struct. Example for Windows:
4040
```cpp
4141
SDL_SysWMinfo info;
4242
SDL_VERSION(&info.version);
@@ -56,30 +56,30 @@ while (true)
5656
{
5757
while (SDL_PollEvent(&event))
5858
{
59-
switch(event.type)
59+
switch (event.type)
6060
{
61-
case SDL_WINDOWEVENT:
62-
{
63-
switch(event.window.event)
64-
{
65-
case SDL_WINDOWEVENT_FOCUS_LOST:
66-
{
67-
// Suspend or destroy swapchain
68-
break;
69-
}
70-
case SDL_WINDOWEVENT_FOCUS_GAINED:
61+
case SDL_WINDOWEVENT:
7162
{
72-
// Resume or recreate swapchain
63+
switch (event.window.event)
64+
{
65+
case SDL_WINDOWEVENT_FOCUS_LOST:
66+
{
67+
// Suspend or destroy swapchain
68+
break;
69+
}
70+
case SDL_WINDOWEVENT_FOCUS_GAINED:
71+
{
72+
// Resume or recreate swapchain
73+
break;
74+
}
75+
case SDL_WINDOWEVENT_RESIZED:
76+
{
77+
// Handle window resize
78+
break;
79+
}
80+
}
7381
break;
7482
}
75-
case SDL_WINDOWEVENT_RESIZED:
76-
{
77-
// Handle window resize
78-
break;
79-
}
80-
}
81-
break;
82-
}
8383
}
8484
}
8585
}
@@ -93,7 +93,7 @@ auto window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOW
9393
```
9494

9595

96-
Copy [SurfaceHelper.mm](https://github.com/DiligentGraphics/DiligentSamples/blob/9be93225a7fdf135583146c1175c232217f310b2/Samples/GLFWDemo/src/SurfaceHelper.mm) file from the GLFW sample into your project.
96+
Copy [SurfaceHelper.mm](https://github.com/DiligentGraphics/DiligentSamples/blob/master/Samples/GLFWDemo/src/SurfaceHelper.mm) file from the GLFW sample into your project.
9797
Modify the following from:
9898
```objective-c
9999
#define GLFW_EXPOSE_NATIVE_COCOA 1
@@ -128,13 +128,13 @@ void* GetNSWindowView(SDL_Window* wnd)
128128
}
129129
```
130130

131-
Use the helper function to get the NSWindowView, setting it in the NativeWindow struct. Then create the vulkan swapchain as normal.
131+
Use the helper function to get the NSWindowView, setting it in the NativeWindow struct. Then create the Vulkan swapchain as normal.
132132

133133
## Android
134134

135135
### Project template
136136

137-
Follow the [official documentation for setting up an android project](https://github.com/libsdl-org/SDL/blob/7fdf7943774d2a54e48718316ca6d55d51a37696/docs/README-android.md) for SDL2.
137+
Follow the [official documentation for setting up an android project](https://github.com/libsdl-org/SDL/blob/main/docs/README-android.md) for SDL2.
138138

139139
#### Optional: Handle devices with screen notch in your derived SDLActivity class:
140140
```java
@@ -266,7 +266,7 @@ Set the Vulkan and fullscreen / resizable window flags when creating the window.
266266
auto window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_width, window_height, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_FULLSCREEN);
267267
```
268268

269-
Then create the swapchain as normal. Keep the swapchain description used.
269+
Then create the swapchain as normal. Keep the swapchain description to be used.
270270
```cpp
271271
auto *pFactoryVk = GetEngineFactoryVk();
272272

@@ -303,7 +303,7 @@ if (device->GetDeviceInfo().IsVulkanDevice())
303303

304304
### OpenGLES
305305

306-
Set the attributes Diligent wants, set the opengl and fullscreen / resizable window flags, create the window, create the context, and finally create the swapchain
306+
Set the attributes Diligent expects, set the OpenGL and fullscreen / resizable window flags, create the window, create the context, and finally create the swapchain
307307
```cpp
308308
const auto color_size = 8;
309309
const auto depth_size = 24;

0 commit comments

Comments
 (0)