SHARE
TWEET

HQ sprite idx

a guest Mar 12th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <algorithm>
  2. #include <iterator>
  3. #include <iostream>
  4.  
  5. unsigned const bounds[] = {170, 350, 520, 720};
  6.  
  7. unsigned calc_HQ_sprite_idx(unsigned rating)
  8. {
  9.    auto const begin = std::begin(bounds);
  10.    auto const end = std::end(bounds);
  11.    auto const it = std::upper_bound(begin, end, rating);
  12.    unsigned const idx = it - begin;
  13.  
  14.    std::cout << "Rating: " << rating << " = sprite[" << idx << "]\n";
  15.    return idx;
  16. }
  17. int main()
  18. {
  19.    calc_HQ_sprite_idx(0);
  20.    calc_HQ_sprite_idx(1000);
  21.    calc_HQ_sprite_idx(500);
  22.    calc_HQ_sprite_idx(520);
  23.    return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top