Scroller.hpp
上传用户:zhj2929
上传日期:2022-07-23
资源大小:28772k
文件大小:1k
- #ifndef _SCROLLER_HPP_
- #define _SCROLLER_HPP_
- class Scroller
- {
- private:
- float mX;
- float mY;
- float mTexWidth;
- float mTexHeight;
- float mTexX;
- float mTexY;
- JQuad* mQuad;
- protected:
- static JGE* mEngine;
- public:
- Scroller(JQuad *quad);
- ~Scroller();
- void Render(float x, float y);
- };
- JGE* Scroller::mEngine = NULL;
- Scroller::Scroller(JQuad *quad): mQuad(quad)
- {
- mX = 0.0f;
- mY = 0.0f;
- quad->GetTextureRect(&mTexX, &mTexY, &mTexWidth, &mTexHeight);
-
- mEngine = JGECreate();
- }
- Scroller::~Scroller()
- {
- JGERelease();
- }
- void Scroller::Render(float x, float y)
- {
- mQuad->SetTextureRect(x, mTexY, x+512.0f, mTexHeight);
- mEngine->RenderQuad(mQuad, 0.0f, y);
- }
- #endif