MCPcopy Create free account
hub / github.com/SFML/SFML / main

Function main

examples/X11/X11.cpp:160–302  ·  view source on GitHub ↗

/////////////////////////////////////////////////////// Entry point of application \return Error code ///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

158///
159////////////////////////////////////////////////////////////
160int main()
161{
162 // Open a connection with the X server
163 Display* display = XOpenDisplay(nullptr);
164 if (!display)
165 return EXIT_FAILURE;
166
167 // Get the default screen
168 const int screen = DefaultScreen(display);
169
170 // Create the main window
171 XSetWindowAttributes attributes;
172 attributes.background_pixel = BlackPixel(display, screen);
173 attributes.event_mask = KeyPressMask;
174 const Window window = XCreateWindow(display,
175 RootWindow(display, screen),
176 0,
177 0,
178 650,
179 330,
180 0,
181 DefaultDepth(display, screen),
182 InputOutput,
183 DefaultVisual(display, screen),
184 CWBackPixel | CWEventMask,
185 &attributes);
186 if (!window)
187 return EXIT_FAILURE;
188
189 // Set the window's name
190 XStoreName(display, window, "SFML Window");
191
192 // Create the windows which will serve as containers for our SFML views
193 const Window view1 = XCreateWindow(display,
194 window,
195 10,
196 10,
197 310,
198 310,
199 0,
200 DefaultDepth(display, screen),
201 InputOutput,
202 DefaultVisual(display, screen),
203 0,
204 nullptr);
205 const Window view2 = XCreateWindow(display,
206 window,
207 330,
208 10,
209 310,
210 310,
211 0,
212 DefaultDepth(display, screen),
213 InputOutput,
214 DefaultVisual(display, screen),
215 0,
216 nullptr);
217

Callers

nothing calls this directly

Calls 8

gladLoadGLES1Function · 0.85
gladLoadGLFunction · 0.85
initializeFunction · 0.85
drawFunction · 0.85
getElapsedTimeMethod · 0.80
setActiveMethod · 0.45
displayMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected