189 lines
4.4 KiB
C++
189 lines
4.4 KiB
C++
|
|
#pragma once
|
|
|
|
#include "QJTVObj.h"
|
|
#include "KTextRender.h"
|
|
#include "KPrimitiveSprite.h"
|
|
|
|
namespace QJTV
|
|
{
|
|
|
|
enum
|
|
{
|
|
STARTPLAY, PLAY, END, OFF
|
|
};
|
|
|
|
enum
|
|
{
|
|
FULL = 1<<2, CENTER = 1<<3, ALPHA = 1<<4,
|
|
};
|
|
|
|
};
|
|
|
|
struct sFrameInfo
|
|
{
|
|
sFrameInfo(): nFrame(0), dwTime(0) {}
|
|
|
|
int nFrame;
|
|
DWORD dwTime;
|
|
};
|
|
|
|
class SGameQJTV
|
|
{
|
|
public:
|
|
SGameQJTV( K3DRenderDeviceDX* pRenderDevice );
|
|
virtual ~SGameQJTV();
|
|
|
|
void Init();
|
|
|
|
void SetQJTV( const char* pFileName, DWORD TextureOption=0, int nStart=0, int nCnt=0, float fixFps=25, KColor BackColor=KColor(0,0,0,0) );
|
|
bool LoadQJTV( int nStart=0, int nCnt=0, KColor BackColor=KColor(0,0,0,0) );
|
|
bool CheckData( int nStart=0, int nCnt=0 );
|
|
|
|
bool CreateTexture( KColor BackColor, int& nSrcWidth, int& nSrcHeight);
|
|
bool RefreshSeenTexture();
|
|
|
|
void SetFixFps(float fixFps) { m_fixFps = fixFps; }
|
|
void SetRepeat(bool bRepeat) { m_bRepeat = bRepeat; }
|
|
void SetMatrix( K3DMatrix Matrix ) { m_Matrix = Matrix; }
|
|
void SetState( int nState );
|
|
bool SetScreenCenter();
|
|
void SetVisibility(float fAmpha) { m_pSpritePrimitive.SetVisibility(fAmpha); }
|
|
void SetUseAlpha( bool bOn ) { m_bUseAlpha = bOn; }
|
|
|
|
void StartPlay();
|
|
void Play();
|
|
void OFF();
|
|
|
|
int SetOff();
|
|
bool IsEnd() { return m_nState == QJTV::END; };
|
|
bool IsOff() { return m_nState == QJTV::OFF; };
|
|
|
|
int Proc( DWORD dwTime );
|
|
int Render( KViewportObject *viewport, bool bFront=true );
|
|
|
|
private:
|
|
trf::MetaData m_Meta;
|
|
QJTVObj m_QJTV;
|
|
|
|
K3DRenderDeviceDX* m_pRenderDevice;
|
|
KSpritePrimitive m_pSpritePrimitive;
|
|
KResSpriteSPtr m_pResSprite;
|
|
K3DTextureSPtr m_pTexture;
|
|
|
|
bool m_bPlay;
|
|
int m_nState;
|
|
int m_nStartFrame;
|
|
K3DMatrix m_Matrix;
|
|
|
|
DWORD m_TextureOption;
|
|
int m_TextureWidth;
|
|
int m_TextureHeight;
|
|
KColor m_BackColor;
|
|
bool m_bSuccessSetting;
|
|
bool m_bSuccessCraeteTexture;
|
|
|
|
DWORD m_StartTime;
|
|
DWORD m_CrrTime;
|
|
DWORD m_OldFrameRenderTime;
|
|
int m_nCrrFrame;
|
|
int m_nFrameCnt;
|
|
int m_nCnt;
|
|
float m_fixFps;
|
|
bool m_bRepeat;
|
|
|
|
bool m_bUseAlpha;
|
|
|
|
std::string m_strFileName;
|
|
};
|
|
|
|
|
|
struct sQJTV
|
|
{
|
|
std::string m_strFileName;
|
|
trf::MetaData m_Meta;
|
|
QJTVObj m_QJTV;
|
|
|
|
bool m_bPlay;
|
|
int m_nState;
|
|
int m_nStartFrame;
|
|
|
|
DWORD m_TextureOption;
|
|
bool m_bSuccessSetting;
|
|
bool m_bSuccessCraeteTexture;
|
|
|
|
DWORD m_StartTime;
|
|
DWORD m_CrrTime;
|
|
DWORD m_OldFrameRenderTime;
|
|
int m_nCrrFrame;
|
|
int m_nFrameCnt;
|
|
int m_nCnt;
|
|
float m_fixFps;
|
|
bool m_bRepeat;
|
|
};
|
|
|
|
class SGameMultiQJTV
|
|
{
|
|
public:
|
|
SGameMultiQJTV( K3DRenderDeviceDX* pRenderDevice, int nWidth, int nHeight, KColor BackColor );
|
|
virtual ~SGameMultiQJTV();
|
|
|
|
void Init();
|
|
|
|
bool AddQJTV( const char* pFileName, DWORD TextureOption=0, int nStart=0, int nCnt=0, float fixFps=25 );
|
|
sQJTV* GetQJTVMovie( const char* lpFileName );
|
|
void ClearTextureBuffer();
|
|
bool SetCrrMovie( const char* lpFileName );
|
|
void SetQJTV( sQJTV* pQJTVSET, const char* pFileName, DWORD TextureOption=0, int nStart=0, int nCnt=0, float fixFps=25 );
|
|
bool LoadQJTV( sQJTV* pQJTVSET, int nStart=0, int nCnt=0 );
|
|
bool CheckData( sQJTV* pQJTVSET, int nStart=0, int nCnt=0 );
|
|
|
|
bool CreateTexture( KColor BackColor, int& nSrcWidth, int& nSrcHeight);
|
|
bool RefreshSeenTexture( sQJTV* pQJTVSET );
|
|
|
|
void SetFixFps(const char* lpName, float fixFps) { sQJTV* pQJTV = GetQJTVMovie(lpName); if( pQJTV ) pQJTV->m_fixFps = fixFps; }
|
|
void SetRepeat(const char* lpName, bool bRepeat) { sQJTV* pQJTV = GetQJTVMovie(lpName); if( pQJTV ) pQJTV->m_bRepeat = bRepeat; }
|
|
void SetMatrix( K3DMatrix Matrix ) { m_Matrix = Matrix; }
|
|
void SetState( int nState );
|
|
bool SetScreenCenter();
|
|
void SetVisibility(float fAmpha) { m_pSpritePrimitive.SetVisibility(fAmpha); }
|
|
|
|
void StartPlay( sQJTV* pQJTVSET, bool bRefreshTexture );
|
|
void Play( sQJTV* pQJTVSET, bool bRefreshTexture );
|
|
void OFF( sQJTV* pQJTVSET );
|
|
|
|
int SetOff();
|
|
bool IsEnd(const char* lpName)
|
|
{
|
|
sQJTV* pQJTV = GetQJTVMovie(lpName);
|
|
if( pQJTV )
|
|
return pQJTV->m_nState == QJTV::END;
|
|
return false;
|
|
};
|
|
bool IsOff(const char* lpName)
|
|
{
|
|
sQJTV* pQJTV = GetQJTVMovie(lpName);
|
|
if( pQJTV )
|
|
return pQJTV->m_nState == QJTV::OFF;
|
|
return false;
|
|
};
|
|
|
|
void Proc( DWORD dwTime );
|
|
int Render( KViewportObject *viewport, bool bFront=true );
|
|
|
|
private:
|
|
int m_nWidthSize;
|
|
int m_nHeightSize;
|
|
KColor m_BackColor;
|
|
|
|
sQJTV* m_pCrrQJTV;
|
|
std::vector<sQJTV*> m_vecQJTV;
|
|
std::vector<std::string> m_vecQJTV_FileName;
|
|
|
|
K3DRenderDeviceDX* m_pRenderDevice;
|
|
KSpritePrimitive m_pSpritePrimitive;
|
|
KResSpriteSPtr m_pResSprite;
|
|
K3DTextureSPtr m_pTexture;
|
|
K3DMatrix m_Matrix;
|
|
};
|