Frame.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * Copyright (c) 2006-2009 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #ifndef LOVE_GRAPHICS_OPENGL_FRAME_H
  21. #define LOVE_GRAPHICS_OPENGL_FRAME_H
  22. // LOVE
  23. #include <common/Object.h>
  24. #include <common/math.h>
  25. #include <graphics/Drawable.h>
  26. namespace love
  27. {
  28. namespace graphics
  29. {
  30. namespace opengl
  31. {
  32. class Frame : public Object
  33. {
  34. private:
  35. vertex vertices[4];
  36. public:
  37. /**
  38. * Creates a new Frame of size (w,h), using (x,y) as the top-left
  39. * anchor point in the source image. The size of the source image is
  40. * is specified by (sw,sh).
  41. *
  42. * @param x Frame source position along the x-axis.
  43. * @param y Frame source position along the y-axis.
  44. * @param w Frame width.
  45. * @param h Frame width.
  46. * @param sw Width of the source image.
  47. * @param sh Height of the source image.
  48. **/
  49. Frame(int x, int y, int w, int h, int sw, int sh);
  50. virtual ~Frame();
  51. void flip(bool x, bool y);
  52. /**
  53. * Gets a pointer to the vertices.
  54. **/
  55. const vertex * getVertices() const;
  56. };
  57. } // opengl
  58. } // graphics
  59. } // love
  60. #endif // LOVE_GRAPHICS_OPENGL_FRAME_H