blob: f641ae771ef525357503ec661ff7de48adf33a45 [file] [log] [blame]
caryclark52edc4d2015-02-02 12:55:14 -08001/*
Brian Osmaneff04b52017-11-21 13:18:02 -05002* Copyright 2017 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
caryclark52edc4d2015-02-02 12:55:14 -08007
8#ifndef HelloWorld_DEFINED
9#define HelloWorld_DEFINED
10
Kevin Lubick88c15ae2022-04-29 10:23:46 -040011#include "include/core/SkScalar.h"
12#include "include/core/SkTypes.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050013#include "tools/sk_app/Application.h"
14#include "tools/sk_app/Window.h"
Kevin Lubick88c15ae2022-04-29 10:23:46 -040015#include "tools/skui/ModifierKey.h"
caryclark52edc4d2015-02-02 12:55:14 -080016
Kevin Lubick88c15ae2022-04-29 10:23:46 -040017class SkSurface;
Jim Van Verthfb3f61d2024-01-18 16:59:01 -050018class SkTypeface;
caryclark52edc4d2015-02-02 12:55:14 -080019
Brian Osman80fc07e2017-12-08 16:45:43 -050020class HelloWorld : public sk_app::Application, sk_app::Window::Layer {
caryclark52edc4d2015-02-02 12:55:14 -080021public:
Brian Osmaneff04b52017-11-21 13:18:02 -050022 HelloWorld(int argc, char** argv, void* platformData);
23 ~HelloWorld() override;
caryclark52edc4d2015-02-02 12:55:14 -080024
Brian Osmaneff04b52017-11-21 13:18:02 -050025 void onIdle() override;
Brian Osman80fc07e2017-12-08 16:45:43 -050026
27 void onBackendCreated() override;
Robert Phillips9882dae2019-03-04 11:00:10 -050028 void onPaint(SkSurface*) override;
Hal Canaryb1f411a2019-08-29 10:39:22 -040029 bool onChar(SkUnichar c, skui::ModifierKey modifiers) override;
caryclark52edc4d2015-02-02 12:55:14 -080030
31private:
Brian Osmaneff04b52017-11-21 13:18:02 -050032 void updateTitle();
caryclark52edc4d2015-02-02 12:55:14 -080033
Brian Osmaneff04b52017-11-21 13:18:02 -050034 sk_app::Window* fWindow;
35 sk_app::Window::BackendType fBackendType;
Jim Van Verthfb3f61d2024-01-18 16:59:01 -050036 sk_sp<SkTypeface> fTypeface;
Brian Osmaneff04b52017-11-21 13:18:02 -050037
caryclark52edc4d2015-02-02 12:55:14 -080038 SkScalar fRotationAngle;
caryclark52edc4d2015-02-02 12:55:14 -080039};
40
41#endif