skia2/tools/viewer/NIMASlide.h
Kevin Lubick d969932474 Refactor Nima code
There were two copies of a Nima "player" and this moves them out of
samplecode/ and viewer/ to experimental/ where it is a bit more
accessible (e.g. for WebAssembly).

Bug: skia:
Change-Id: I05419a352f0d13d16b462a374578107513eb1243
Reviewed-on: https://skia-review.googlesource.com/c/166441
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-10-30 19:32:52 +00:00

49 lines
1.1 KiB
C++

/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef NIMASlide_DEFINED
#define NIMASlide_DEFINED
#include "Slide.h"
#include "SkCanvas.h"
#include "SkVertices.h"
#include "nima/NimaActor.h"
class NIMASlide : public Slide {
public:
NIMASlide(const SkString& name, const SkString& path);
~NIMASlide() override;
SkISize getDimensions() const override;
void draw(SkCanvas* canvas) override;
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
bool animate(const SkAnimTimer& timer) override;
bool onChar(SkUnichar c) override;
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState state,
uint32_t modifiers) override;
private:
void resetActor();
void renderGUI();
private:
std::string fBasePath;
std::unique_ptr<NimaActor> fActor;
int fAnimationIndex;
bool fPlaying;
float fTime;
uint32_t fRenderFlags;
};
#endif