Jeremy Bullock 764038
#pragma once
Jeremy Bullock 764038
Jeremy Bullock 764038
#ifndef TTIO_SPRITE_INCLUDED
Jeremy Bullock 764038
#define TTIO_SPRITE_INCLUDED
Jeremy Bullock 764038
Jeremy Bullock 764038
#include "tproperty.h"
Jeremy Bullock 764038
#include "tlevel_io.h"
Jeremy Bullock 764038
#include "trasterimage.h"
Jeremy Bullock 764038
#include <qvector></qvector>
Jeremy Bullock 764038
#include <qstringlist></qstringlist>
Jeremy Bullock 764038
#include <qtgui qimage=""></qtgui>
Jeremy Bullock 764038
//===========================================================
Jeremy Bullock 764038
//
Jeremy Bullock 764038
//  TLevelWriterSprite
Jeremy Bullock 764038
//
Jeremy Bullock 764038
//===========================================================
Jeremy Bullock 764038
Jeremy Bullock 764038
class TLevelWriterSprite : public TLevelWriter {
Jeremy Bullock 764038
public:
Jeremy Bullock 764038
  TLevelWriterSprite(const TFilePath &path, TPropertyGroup *winfo);
Jeremy Bullock 764038
  ~TLevelWriterSprite();
Jeremy Bullock 764038
  void setFrameRate(double fps);
Jeremy Bullock 764038
Jeremy Bullock 764038
  TImageWriterP getFrameWriter(TFrameId fid) override;
Jeremy Bullock 764038
  void save(const TImageP &image, int frameIndex);
Jeremy Bullock 764038
Jeremy Bullock 764038
  void saveSoundTrack(TSoundTrack *st);
Jeremy Bullock 764038
Jeremy Bullock 764038
  static TLevelWriter *create(const TFilePath &path, TPropertyGroup *winfo) {
Jeremy Bullock 764038
    return new TLevelWriterSprite(path, winfo);
Jeremy Bullock 764038
  }
Jeremy Bullock 764038
Jeremy Bullock 764038
private:
Jeremy Bullock 764038
  int m_lx, m_ly;
Jeremy Bullock 764038
  int m_scale;
Jeremy Bullock 764038
  int m_topPadding, m_bottomPadding, m_leftPadding, m_rightPadding;
Jeremy Bullock 764038
  int m_left = 0, m_right = 0, m_top = 0, m_bottom = 0;
Jeremy Bullock 764038
  std::vector<qimage *=""> m_images;</qimage>
Jeremy Bullock 764038
  std::vector<qimage> m_imagesResized;</qimage>
Jeremy Bullock 63a3d7
  std::vector<int> m_frameIndexOrder;</int>
Jeremy Bullock 764038
  bool m_firstPass = true;
Jeremy Bullock 6f3194
  bool m_trim      = true;
Jeremy Bullock 764038
  QString m_format;
Jeremy Bullock 764038
  // void *m_buffer;
Jeremy Bullock 764038
};
Jeremy Bullock 764038
Jeremy Bullock 764038
//===========================================================================
Jeremy Bullock 764038
Jeremy Bullock 764038
namespace Tiio {
Jeremy Bullock 764038
Jeremy Bullock 764038
//===========================================================================
Jeremy Bullock 764038
Jeremy Bullock 764038
class SpriteWriterProperties : public TPropertyGroup {
Jeremy Bullock 764038
public:
Jeremy Bullock 764038
  TEnumProperty m_format;
Jeremy Bullock 764038
  TIntProperty m_topPadding, m_bottomPadding, m_leftPadding, m_rightPadding;
Jeremy Bullock 764038
  TIntProperty m_scale;
Jeremy Bullock 6f3194
  TBoolProperty m_trim;
Jeremy Bullock 764038
  SpriteWriterProperties();
Jeremy Bullock 764038
};
Jeremy Bullock 764038
Jeremy Bullock 764038
//===========================================================================
Jeremy Bullock 764038
Jeremy Bullock 764038
}  // namespace
Jeremy Bullock 764038
Jeremy Bullock 764038
#endif