CCIMXDesktop
 
Loading...
Searching...
No Matches
GroundLineProviders.h
1
6#ifndef GROUNDLINEPROVIDERS_H
7#define GROUNDLINEPROVIDERS_H
8
10#include <QList>
11class QPainter;
12
17public:
22
27
33 explicit GroundLineProviders(int patternLength, int h);
34
39 struct GroundLine {
40 int x;
41 int y0;
42 int length;
43 float phase;
44 };
45
50 void initGroundLines(int count = 200);
51
56 void update_params(int scrollSpeed);
57
64 void drawLines(QPainter* painter, int w, int h);
65
66private:
70 int scrollOffsetX { 0 };
71
75 int sceneHeight;
76
80 int sceneWidth;
81
85 float time = 0;
86
90 static constexpr int groundY = Settings::Scene::Ground::GROUND_Y_POS;
91
95 QList<GroundLine> groundLines;
96};
97
98#endif // GROUNDLINEPROVIDERS_H
A utility class to manage and render dynamic ground lines.
Definition GroundLineProviders.h:16
void update_params(int scrollSpeed)
Updates ground line parameters based on scrolling speed.
Definition GroundLineProviders.cpp:24
GroundLineProviders()=delete
Deleted default constructor to enforce parameterized construction.
void initGroundLines(int count=200)
Initializes ground lines.
Definition GroundLineProviders.cpp:12
Q_DISABLE_COPY_MOVE(GroundLineProviders)
Disables copy and move semantics.
void drawLines(QPainter *painter, int w, int h)
Draws the ground lines on the given painter.
Definition GroundLineProviders.cpp:32
Defines constants and settings related to the game scene and its behavior.
Represents a single ground line with position, length, and animation phase.
Definition GroundLineProviders.h:39
int x
Starting x-position of the line.
Definition GroundLineProviders.h:40
int length
Length of the ground line.
Definition GroundLineProviders.h:42
int y0
Initial vertical position.
Definition GroundLineProviders.h:41
float phase
Animation phase of the line.
Definition GroundLineProviders.h:43