subtitle.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program 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. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /****************************************************************************
  19. *
  20. * FILE
  21. * $Archive: /Commando/Code/BinkMovie/subtitle.h $
  22. *
  23. * DESCRIPTION
  24. * Subtitling support.
  25. *
  26. * PROGRAMMER
  27. * Denzil E. Long, Jr.
  28. *
  29. * VERSION INFO
  30. * $Author: Denzil_l $
  31. * $Modtime: 1/15/02 8:48p $
  32. * $Revision: 2 $
  33. *
  34. ****************************************************************************/
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef _SUBTITLE_H_
  39. #define _SUBTITLE_H_
  40. #include "always.h"
  41. #include "wwdebug.h"
  42. #include <wchar.h>
  43. class SubTitleClass
  44. {
  45. public:
  46. SubTitleClass();
  47. ~SubTitleClass();
  48. // Set the time (in milliseconds) at which the subtitle is to be displayed.
  49. void Set_Display_Time(unsigned long time) { mTimeStamp = time; }
  50. // Retrieve the time in ticks (1/60 seconds) this subtitle is to be displayed.
  51. unsigned long Get_Display_Time(void) const { return mTimeStamp; }
  52. // Set the time duration in ticks (1/60 seconds) for the subtitle to remain displayed.
  53. void Set_Display_Duration(unsigned long duration) { mDuration = duration; }
  54. // Retrieve the duration time in ticks (1/60 seconds) for the subtitle.
  55. unsigned long Get_Display_Duration(void) const { return mDuration; }
  56. // Set the color the subtitle caption should be displayed in.
  57. void Set_RGB_Color(unsigned char red, unsigned char green, unsigned char blue);
  58. // Retrieve the color of the subtitle
  59. unsigned long Get_RGB_Color(void) const { return mRGBColor; }
  60. // Set the line position the subtitle should be displayed at.
  61. void Set_Line_Position(int linePos)
  62. {
  63. WWASSERT((linePos >= 1) && (linePos <= 15));
  64. mLinePosition = linePos;
  65. }
  66. // Retrieve the line position to display the subtitle at.
  67. int Get_Line_Position(void) const { return mLinePosition; }
  68. // Caption justifications
  69. typedef enum
  70. {
  71. Left,
  72. Right,
  73. Center,
  74. } Alignment;
  75. // Set the alignment of the subtitle caption
  76. void Set_Alignment(Alignment align)
  77. {mAlignment = align;}
  78. // Retrieve the caption justification
  79. Alignment Get_Alignment(void) const { return mAlignment; }
  80. // Set the caption text
  81. void Set_Caption(wchar_t* string);
  82. // Retrieve the caption text
  83. const wchar_t* Get_Caption(void) const { return mCaption; }
  84. private:
  85. unsigned long mTimeStamp;
  86. unsigned long mDuration;
  87. unsigned long mRGBColor;
  88. int mLinePosition;
  89. Alignment mAlignment;
  90. wchar_t* mCaption;
  91. };
  92. #endif // _SUBTITLE_H_