Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gr::Clip::Clip(Button& button, const sf::Texture& texture, Orientation orientation,
- std::initializer_list<CLICKSTATUS> states):
- Clip(
- button,
- texture,
- [&states, &orientation, ts = texture.getSize()] {
- FrameArray<int> frames;
- std::function<sf::IntRect(size_t)> makeFrame;
- if(orientation == Orientation::Horizontal) {
- makeFrame = [&ts, frdim = ts.x / states.size()] (size_t indx) {
- return sf::IntRect(frdim * indx, 0, frdim, ts.y);
- };
- }
- else {
- makeFrame = [&ts, frdim = ts.x / states.size()] (size_t indx) {
- return sf::IntRect(0, frdim * indx, ts.x, frdim);
- };
- }
- size_t j = 0;
- for(const auto& ele : states) {
- frames[int(ele)] = makeFrame(j++);
- }
- return frames;
- }()
- )
- {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement