glslop.hpp 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* glslop.hpp: exposes an opengl selection interface
  2. *
  3. * Copyright (C) 2014: Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors).
  4. *
  5. * This file is part of Slop.
  6. *
  7. * Slop is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * Slop is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with Slop. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef N_SLOP_H_
  21. #define N_SLOP_H_
  22. #include <string>
  23. #include "window.hpp"
  24. #include "shader.hpp"
  25. #include "framebuffer.hpp"
  26. #include "rectangle.hpp"
  27. #include "slopstates.hpp"
  28. #include "keyboard.hpp"
  29. #include "mouse.hpp"
  30. #include "resource.hpp"
  31. class SlopState;
  32. class SlopOptions {
  33. public:
  34. SlopOptions();
  35. float borderSize;
  36. float padding;
  37. float tolerance;
  38. bool highlight;
  39. bool nodecorations;
  40. std::string shader;
  41. float r;
  42. float g;
  43. float b;
  44. float a;
  45. std::string xdisplay;
  46. };
  47. class SlopSelection {
  48. public:
  49. SlopSelection( float x, float y, float w, float h, Window id );
  50. float x;
  51. float y;
  52. float w;
  53. float h;
  54. Window id;
  55. };
  56. class SlopMemory {
  57. private:
  58. SlopState* state;
  59. SlopState* nextState;
  60. public:
  61. SlopMemory( SlopOptions* options );
  62. ~SlopMemory();
  63. Window selectedWindow;
  64. bool running;
  65. float tolerance;
  66. bool nodecorations;
  67. Rectangle* rectangle;
  68. void setState( SlopState* state );
  69. void update( double dt );
  70. void draw( glm::mat4& matrix );
  71. };
  72. SlopSelection SlopSelect( SlopOptions* options = NULL, bool* cancelled = NULL );
  73. #endif // N_SLOP_H_