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

Function main

examples/win32/Win32.cpp:55–168  ·  view source on GitHub ↗

/////////////////////////////////////////////////////// Entry point of application \param Instance: Instance of the application \return Error code ///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

53///
54////////////////////////////////////////////////////////////
55int main()
56{
57 HINSTANCE instance = GetModuleHandle(nullptr);
58
59 // Define a class for our main window
60 WNDCLASS windowClass;
61 windowClass.style = 0;
62 windowClass.lpfnWndProc = &onEvent;
63 windowClass.cbClsExtra = 0;
64 windowClass.cbWndExtra = 0;
65 windowClass.hInstance = instance;
66 windowClass.hIcon = nullptr;
67 windowClass.hCursor = nullptr;
68 windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BACKGROUND);
69 windowClass.lpszMenuName = nullptr;
70 windowClass.lpszClassName = TEXT("SFML App");
71 RegisterClass(&windowClass);
72
73 // Create the main window
74 HWND window = CreateWindow(TEXT("SFML App"),
75 TEXT("SFML Win32"),
76 WS_SYSMENU | WS_VISIBLE,
77 200,
78 200,
79 660,
80 520,
81 nullptr,
82 nullptr,
83 instance,
84 nullptr);
85
86 // Add a button for exiting
87 button = CreateWindow(TEXT("BUTTON"), TEXT("Quit"), WS_CHILD | WS_VISIBLE, 560, 440, 80, 40, window, nullptr, instance, nullptr);
88
89 // Create two SFML views
90 HWND view1 = CreateWindow(TEXT("STATIC"),
91 nullptr,
92 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
93 20,
94 20,
95 300,
96 400,
97 window,
98 nullptr,
99 instance,
100 nullptr);
101 HWND view2 = CreateWindow(TEXT("STATIC"),
102 nullptr,
103 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
104 340,
105 20,
106 300,
107 400,
108 window,
109 nullptr,
110 instance,
111 nullptr);
112 sf::RenderWindow sfmlView1(view1);

Callers

nothing calls this directly

Calls 10

setOriginMethod · 0.80
getOriginMethod · 0.80
getElapsedTimeMethod · 0.80
getSizeMethod · 0.45
setPositionMethod · 0.45
clearMethod · 0.45
setRotationMethod · 0.45
drawMethod · 0.45
displayMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected