MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / main

Function main

Applications/Minesweeper/main.cpp:269–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269int main(int argc, char** argv){
270 window = new Lemon::GUI::Window("Minesweeper", {160, 160}, 0, Lemon::GUI::GUI);
271 window->rootContainer.background = {0, 0, 0, 0};
272
273 window->CreateMenuBar();
274 window->menuBar->items.push_back(gameMenu);
275
276 Lemon::Graphics::LoadImage("/initrd/minesweeper.png", &resources);
277
278 UpdateWindowSize();
279
280 window->AddWidget(&game);
281 window->Paint();
282
283 while(!window->closed){
284 Lemon::LemonEvent ev;
285 while (window->PollEvent(ev))
286 {
287 switch(ev.event){
288 case Lemon::EventWindowCommand:
289 switch(ev.windowCmd){
290 case MenuEasy:
291 game.Generate(EasyDifficulty);
292 break;
293 case MenuMedium:
294 game.Generate(MediumDifficulty);
295 break;
296 case MenuHard:
297 game.Generate(HardDifficulty);
298 break;
299 }
300 UpdateWindowSize();
301 break;
302 default:
303 window->GUIHandleEvent(ev);
304 break;
305 }
306 }
307
308 window->Paint();
309
310 window->WaitEvent();
311 }
312
313 delete window;
314
315 return 0;
316}

Callers

nothing calls this directly

Calls 9

UpdateWindowSizeFunction · 0.85
CreateMenuBarMethod · 0.80
PollEventMethod · 0.80
GenerateMethod · 0.80
GUIHandleEventMethod · 0.80
WaitEventMethod · 0.80
LoadImageFunction · 0.50
AddWidgetMethod · 0.45
PaintMethod · 0.45

Tested by

no test coverage detected