Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SFML ANIMATOR
/* **samuel ugochukwu nwutobo **sammycageagle@gmail.com **SFML ANIMATOR */ #include <iostream> #include <vector> using namespace std; struct Vector2i { Vector2i (int a, int b):x(a),y(b) {} int x; int y; }; struct IntRect { IntRect (int a,int b,int c,int d):height(a),width(b),top(c),left(d) {} int height; int width; int top; int left; }; class Animator { public: string m_Name; string m_TextureName; vector<IntRect>m_Frames; bool m_looping; Animator(string const& name,string const& textureName, bool looping) :m_Name(name),m_TextureName(textureName),m_looping(looping) {} void AddFrames(Vector2i const& startFrom, Vector2i const& frameSize, int frames) { Vector2i current =startFrom; for(int i=0; i<frames; i++) { m_Frames.push_back(IntRect(current.x,current.y,frameSize.x,frameSize.y)); current.x += frameSize.x; }} void print() { for(int i=0;i<9;i++) { IntRect m(m_Frames[i]); cout<<m.width<<endl; cout<<m.height<<endl; cout<<m.top<<endl; cout<<m.left<<endl; cout<<endl; } } }; int main() { Vector2i size(6,5); Vector2i start(11,5); Animator coin("panes","samuel",true); coin.AddFrames(size,start,5); coin.print(); }
run
|
edit
|
history
|
help
0
12hours Clock c++
c++ mouse
Web Browser History - LIST
ContainerVector
SEJM BLURWA
single_digit
AVL - ith element
BinTreeInsert
Listas enlazadas - merge
Faaaaak