mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 15:21:30 +02:00
The crash launched him. Rotating 66 degrees about a pivot inside the sprite, shearing him through the middle and scaling him about the same point left him diagonal in mid-air, elongated, nowhere near the ground — a stunt, not a trip. It is now a face-plant and a skid: 26 degrees, a 21px drop so the snout reaches the grass, and 26px of forward slide along the ground with the dust coming up. The shear is gone entirely. The pivot is the snout at the grass line rather than a point inside the body. The other half of looking airborne was the frozen frame: stopping a run cycle leaves whatever mid-stride pose the gif was on, legs extended. He now lands on frame 4, the one with the legs tucked under him. Clearing the field and getting across now says WIN, with the tally, the way eating it says GAME OVER. Before, a won lap just ended and the next one opened with a doge sitting down, which reads as nothing having happened. And the scene comes in three amounts, because a form should not have to compete with a dog: History runs the whole thing, Receive is a doge sitting in the field, Send is money blowing past and nothing else. One QML file, gated by mode; the beat machine only runs where there is a run. Claude-Session: https://claude.ai/code/session_01VLQ5DsgKv23osGANoFT3zF
77 lines
3.2 KiB
C++
77 lines
3.2 KiB
C++
// SPDX-License-Identifier: BSD-3-Clause
|
|
// SPDX-FileCopyrightText: The Monero Project
|
|
|
|
#ifndef WOWLET_SCENEWIDGET_H
|
|
#define WOWLET_SCENEWIDGET_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QQuickWidget>
|
|
|
|
// Context object exposed to scene.qml as `sceneCtx`. Carries the reduced-motion
|
|
// setting so the scene freezes into its still (reduced-motion) form, and the
|
|
// sky variant so the tabs are not all showing the same field.
|
|
class SceneBackend : public QObject {
|
|
Q_OBJECT
|
|
Q_PROPERTY(bool reducedMotion READ reducedMotion NOTIFY reducedMotionChanged)
|
|
Q_PROPERTY(int variant READ variant NOTIFY variantChanged)
|
|
Q_PROPERTY(QString mode READ mode NOTIFY modeChanged)
|
|
public:
|
|
explicit SceneBackend(QObject *parent = nullptr) : QObject(parent) {}
|
|
bool reducedMotion() const { return m_reducedMotion; }
|
|
void setReducedMotion(bool r) { if (m_reducedMotion != r) { m_reducedMotion = r; emit reducedMotionChanged(); } }
|
|
int variant() const { return m_variant; }
|
|
void setVariant(int v) { if (m_variant != v) { m_variant = v; emit variantChanged(); } }
|
|
QString mode() const { return m_mode; }
|
|
void setMode(const QString &m) { if (m_mode != m) { m_mode = m; emit modeChanged(); } }
|
|
signals:
|
|
void reducedMotionChanged();
|
|
void variantChanged();
|
|
void modeChanged();
|
|
private:
|
|
bool m_reducedMotion = false;
|
|
int m_variant = 0;
|
|
QString m_mode = QStringLiteral("run");
|
|
};
|
|
|
|
// wowlet: reusable ambient-scene surface. Hosts scene.qml and reads the
|
|
// reduced-motion preference from Config. Drop it behind a form, into a banner,
|
|
// or over the window as an idle screensaver.
|
|
class SceneWidget : public QQuickWidget {
|
|
Q_OBJECT
|
|
public:
|
|
// Sky variants, one per host, so History/Send/Receive do not all show the
|
|
// same field. Must match the `skies` table in scene.qml.
|
|
enum Variant { Dusk = 0, Dawn = 1, Night = 2 };
|
|
|
|
// How much scene a surface wants. History has room for the whole run;
|
|
// Receive gets a doge sitting in the field; Send gets money blowing past and
|
|
// nothing else, so the form it sits under is not competing with a dog.
|
|
enum Mode { Run, Sit, Money };
|
|
|
|
explicit SceneWidget(QWidget *parent = nullptr, Variant variant = Dusk,
|
|
Mode mode = Run);
|
|
void refreshReducedMotion();
|
|
|
|
protected:
|
|
// A scene on a hidden tab is parked rather than left running: an unshown
|
|
// QQuickWidget is 0px wide, and a lap run against a 0px field collects every
|
|
// coin at once and leaves its litter (+1s, barks) to surface on the real lap
|
|
// when the tab is finally shown. Parking also keeps a background tab from
|
|
// burning CPU on animation nobody is looking at.
|
|
void showEvent(QShowEvent *event) override;
|
|
void hideEvent(QHideEvent *event) override;
|
|
// Belt and braces: a scene that is on screen and has just been given a real
|
|
// size is running, whether or not a show event was the thing that got it
|
|
// there. `restart` only sets a flag, so re-arming an already-running scene
|
|
// costs nothing and does not interrupt its lap.
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
private:
|
|
void callScene(const char *method);
|
|
|
|
SceneBackend *m_backend;
|
|
};
|
|
|
|
#endif //WOWLET_SCENEWIDGET_H
|