QGearsTile.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include <Ogre.h>
  17. #include "common/TypeDefine.h"
  18. namespace QGears{
  19. enum Blending{
  20. /**
  21. * Tile blending mode: Alpha.
  22. */
  23. B_ALPHA,
  24. /**
  25. * Tile blending mode: Add
  26. */
  27. B_ADD,
  28. /**
  29. * Tile blending mode: Substract
  30. */
  31. B_SUBTRACT
  32. };
  33. /**
  34. * A tile key frame.
  35. */
  36. struct KeyFrame{
  37. /**
  38. * Key frame timestamp.
  39. */
  40. Ogre::Real time;
  41. /**
  42. * Key frame movement coordinates.
  43. */
  44. Ogre::Vector4 uv;
  45. };
  46. typedef std::vector<KeyFrame> KeyFrameList;
  47. /**
  48. * A tile animation
  49. */
  50. struct Animation{
  51. /**
  52. * Animation length.
  53. *
  54. * @todo Units? Seconds?
  55. */
  56. Ogre::Real length;
  57. /**
  58. * List of key frames of the animation.
  59. */
  60. KeyFrameList key_frames;
  61. };
  62. typedef std::map<String, Animation> AnimationMap;
  63. /**
  64. * A tile.
  65. */
  66. struct Tile{
  67. /**
  68. * Tile width.
  69. */
  70. int width;
  71. /**
  72. * Tile hecight.
  73. */
  74. int height;
  75. /**
  76. * Tile destination coordinates in the background.
  77. */
  78. Ogre::Vector2 destination;
  79. /**
  80. * @todo Understand and document.
  81. */
  82. Ogre::Vector4 uv;
  83. /**
  84. * Tile depth.
  85. */
  86. Ogre::Real depth;
  87. /**
  88. * Tile blending type.
  89. */
  90. Blending blending;
  91. /**
  92. * List of animations associated to the tile.
  93. */
  94. AnimationMap animations;
  95. };
  96. }