Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SFML ANIMATOR
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
/* **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(); }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.42 sec, absolute running time: 0.06 sec, cpu time: 0 sec, memory peak: 3 Mb, absolute service time: 0,49 sec
edit mode
|
history
|
discussion
5 6 11 5 5 17 11 5 5 28 11 5 5 39 11 5 5 50 11 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4113 0