ff2e8fe65f
replace() { if git grep -q "$1")"; then sed -i -e "s#${1}#${2}#g" $(git grep -l "$1"); fi } replace 'k\([A-Za-z]*\)_InputState' 'InputState::k\1' replace '\(\(sk_app::\|\)Window\|Sample\|\)::InputState' 'InputState' Change-Id: I4cc18814fb1fbdd1f240aabba05aae79c54a4841 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227642 Commit-Queue: Hal Canary <halcanary@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
/*
|
|
* Copyright 2019 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef ParticlesSlide_DEFINED
|
|
#define ParticlesSlide_DEFINED
|
|
|
|
#include "tools/viewer/Slide.h"
|
|
|
|
#include "include/core/SkPath.h"
|
|
#include "include/private/SkTArray.h"
|
|
#include "include/utils/SkRandom.h"
|
|
|
|
class SkParticleEffect;
|
|
class SkParticleEffectParams;
|
|
|
|
class ParticlesSlide : public Slide {
|
|
public:
|
|
ParticlesSlide();
|
|
|
|
// TODO: We need a way for primarily interactive slides to always be as large as the window
|
|
SkISize getDimensions() const override { return SkISize::MakeEmpty(); }
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
|
void draw(SkCanvas* canvas) override;
|
|
bool animate(double) override;
|
|
|
|
bool onMouse(SkScalar x, SkScalar y, InputState state,
|
|
ModifierKey modifiers) override;
|
|
|
|
private:
|
|
void loadEffects(const char* dirname);
|
|
|
|
SkRandom fRandom;
|
|
bool fAnimated = false;
|
|
double fAnimationTime = 0;
|
|
SkPoint fPlayPosition;
|
|
|
|
struct LoadedEffect {
|
|
SkString fName;
|
|
sk_sp<SkParticleEffectParams> fParams;
|
|
};
|
|
SkTArray<LoadedEffect> fLoaded;
|
|
|
|
struct RunningEffect {
|
|
SkPoint fPosition;
|
|
SkString fName;
|
|
sk_sp<SkParticleEffect> fEffect;
|
|
};
|
|
SkTArray<RunningEffect> fRunning;
|
|
};
|
|
|
|
#endif
|