Skip to content
Snippets Groups Projects
Commit ca1116fe authored by ftomi's avatar ftomi
Browse files

Animation ok

MxFrame, spisender small update
parent 2f4640be
No related branches found
No related tags found
No related merge requests found
......@@ -12,20 +12,28 @@ void Animation::openFile(const QString filepath)
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
frames.clear();
frameId = 0;
QTextStream in(&file);
while (!file.atEnd()) {
QString line = file.readLine();
frames.push_back(line);
frames.push_back(MxFrame(line));
}
file.close();
}
}
QString Animation::nextFrame()
bool Animation::eof()
{
if (frameId < frames.size()) {
return frameId >= frames.size();
}
MxFrame Animation::nextFrame()
{
if (!eof()) {
return frames[frameId++];
} else {
return "";
}
else {
return MxFrame();
}
}
......@@ -4,17 +4,20 @@
#include <QFile>
#include <QString>
#include <vector>
#include "mxframe.h"
#include "spiframe.h"
#include <tuple>
class Animation
{
private:
std::vector<QString> frames;
std::vector<MxFrame> frames;
uint32_t frameId = 0;
public:
Animation();
void openFile(const QString filepath);
QString nextFrame();
//TODO read frames
MxFrame nextFrame();
bool eof();
};
#endif // ANIMATION_H
......@@ -4,3 +4,8 @@ MxFrame::MxFrame()
{
}
MxFrame::MxFrame(const QString &import)
{
//TODO
}
......@@ -2,11 +2,13 @@
#define MXFRAME_H
#include <QColor>
#include <QString>
class MxFrame
{
public:
MxFrame();
MxFrame(const QString& import);
QColor pixels[26][32];
uint32_t length;
};
......
......@@ -10,6 +10,12 @@ int SpiSender::getReadyPin() const
}
bool SpiSender::sendFrame(const SpiFrame &frame) const
{
//TODO
return canSend();
}
bool SpiSender::canSend() const
{
//TODO
return true;
......
......@@ -12,6 +12,7 @@ public:
SpiSender(int readyPin);
int getReadyPin() const;
bool sendFrame(const SpiFrame& frame) const;
bool canSend() const;
};
#endif // SPISENDER_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment