Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for adding captions to the time line.
- Loading branch information
Showing
8 changed files
with
291 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
Copyright (C) 2010 Andrew Caudwell (acaudwell@gmail.com) | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version | ||
3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "caption.h" | ||
|
||
RCaption::RCaption(const std::string& caption, time_t timestamp, const FXFont& font) { | ||
this->caption = caption; | ||
this->timestamp = timestamp; | ||
this->font = font; | ||
|
||
alpha = 1.0f; | ||
colour = gGourceSettings.caption_colour; | ||
decay = 1.0f / gGourceSettings.caption_duration; | ||
} | ||
|
||
const vec2f& RCaption::getPos() { | ||
return pos; | ||
} | ||
|
||
void RCaption::setPos(const vec2f& pos) { | ||
this->pos = pos; | ||
} | ||
|
||
bool RCaption::isFinished() { | ||
return alpha <= 0.0f; | ||
} | ||
|
||
void RCaption::logic(float dt) { | ||
alpha = std::max(0.0f, alpha - dt * decay); | ||
} | ||
|
||
void RCaption::draw() const { | ||
glColor4f(colour.x, colour.y, colour.z, 1.0f - fabs(alpha - 0.5) * 2.0f); | ||
|
||
font.draw(pos.x, pos.y, caption); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
Copyright (C) 2010 Andrew Caudwell (acaudwell@gmail.com) | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version | ||
3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef RCAPTION_H | ||
#define RCAPTION_H | ||
|
||
#include "core/display.h" | ||
#include "core/fxfont.h" | ||
#include "gource_settings.h" | ||
|
||
class RCaption { | ||
float alpha; | ||
float decay; | ||
|
||
vec2f pos; | ||
|
||
vec3f colour; | ||
|
||
FXFont font; | ||
FXFont font2; | ||
|
||
public: | ||
std::string caption; | ||
time_t timestamp; | ||
|
||
RCaption(const std::string& caption, time_t timestamp, const FXFont& font); | ||
|
||
void setPos(const vec2f& pos); | ||
const vec2f& getPos(); | ||
|
||
bool isFinished(); | ||
|
||
void logic(float dt); | ||
|
||
void draw() const; | ||
}; | ||
|
||
#endif |
Submodule core
updated
2 files
+14 −7 | conffile.cpp | |
+2 −0 | conffile.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.