mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09:00
Spider: Port to the GML compiler
This commit is contained in:
parent
b7bcdf7c53
commit
65b9cb63ee
Notes:
sideshowbarker
2024-07-17 05:58:46 +09:00
Author: https://github.com/david072
Commit: 65b9cb63ee
Pull-request: https://github.com/SerenityOS/serenity/pull/21907
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 29 additions and 9 deletions
|
@ -4,15 +4,12 @@ serenity_component(
|
|||
TARGETS Spider
|
||||
)
|
||||
|
||||
stringify_gml(Spider.gml SpiderGML.h spider_gml)
|
||||
compile_gml(Spider.gml SpiderGML.cpp spider_gml)
|
||||
|
||||
set(SOURCES
|
||||
Game.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set(GENERATED_SOURCES
|
||||
SpiderGML.h
|
||||
SpiderGML.cpp
|
||||
)
|
||||
|
||||
serenity_app(Spider ICON app-spider)
|
||||
|
|
23
Userland/Games/Spider/MainWidget.h
Normal file
23
Userland/Games/Spider/MainWidget.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2023, the SerenityOS developers
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
namespace Spider {
|
||||
|
||||
class MainWidget : public GUI::Widget {
|
||||
C_OBJECT_ABSTRACT(MainWidget)
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Spider::MainWidget>> try_create();
|
||||
virtual ~MainWidget() override = default;
|
||||
|
||||
private:
|
||||
MainWidget() = default;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@GUI::Widget {
|
||||
@Spider::MainWidget {
|
||||
fill_with_background_color: true
|
||||
layout: @GUI::VerticalBoxLayout {}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
#include "Game.h"
|
||||
#include "MainWidget.h"
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <AK/URL.h>
|
||||
#include <Games/Spider/SpiderGML.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibCore/Timer.h>
|
||||
|
@ -116,8 +116,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (statistic_display >= StatisticDisplay::__Count)
|
||||
update_statistic_display(StatisticDisplay::HighScore);
|
||||
|
||||
auto widget = window->set_main_widget<GUI::Widget>();
|
||||
TRY(widget->load_from_gml(spider_gml));
|
||||
auto widget = TRY(Spider::MainWidget::try_create());
|
||||
window->set_main_widget(widget);
|
||||
|
||||
auto& game = *widget->find_descendant_of_type_named<Spider::Game>("game");
|
||||
game.set_focus(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue