mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:57:34 +00:00
Minesweeper: More implementation work.
This commit is contained in:
parent
a90e218c71
commit
4df360be8c
7 changed files with 42 additions and 27 deletions
|
@ -1,6 +1,8 @@
|
|||
#include "Field.h"
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -8,9 +10,27 @@ int main(int argc, char** argv)
|
|||
|
||||
auto* window = new GWindow;
|
||||
window->set_title("Minesweeper");
|
||||
window->set_rect(100, 100, 200, 300);
|
||||
auto* field = new Field(nullptr);
|
||||
window->set_main_widget(field);
|
||||
window->set_rect(100, 100, 135, 171);
|
||||
|
||||
auto* widget = new GWidget;
|
||||
window->set_main_widget(widget);
|
||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
|
||||
auto* container = new GWidget(widget);
|
||||
container->set_fill_with_background_color(true);
|
||||
container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
container->set_preferred_size({ 0, 36 });
|
||||
container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
auto* face_button = new GButton(container);
|
||||
face_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
face_button->set_preferred_size({ 32, 32 });
|
||||
face_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/minesweeper/face-default.png"));
|
||||
|
||||
auto* field = new Field(widget);
|
||||
|
||||
face_button->on_click = [field] (auto&) {
|
||||
field->reset();
|
||||
};
|
||||
|
||||
window->show();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue