Sprite.cpp
上传用户:jalin138
上传日期:2022-02-12
资源大小:5720k
文件大小:1k
- #include "Sprite.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- CSprite::CSprite(int _itype,int _jtype,int _n)
- {
- m_fx = 0.0f;
- m_fy = 0.0f;
- a = 255;
- n = 0;
- m_nType = rand()%_n+1;
- while ( m_nType == _itype || m_nType == _jtype )
- {
- m_nType = rand()%_n+1;
- }
- char sprName[24] = {0};
- sprintf_s( sprName, sizeof(sprName), "sprSprite%d", m_nType );
- m_pSpr = g_Res->GetSprite( sprName );
- }
- CSprite::~CSprite(void)
- {
- m_pSpr = NULL;
- }
- void CSprite::Render(float _size)
- {
- m_pSpr->SetColor( ARGB(a,255,255,255) );
- m_pSpr->RenderEx( m_fx, m_fy, 0.0f, _size, _size );
- }