diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-10-24 21:14:59 -0200 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2017-10-24 21:14:59 -0200 |
commit | 39a34b99185b3c046fb4427d07dd333575962e29 (patch) | |
tree | 6654d829e82410a6ab0525d2273aeb523f124523 /Project/OpenGLText.h | |
parent | 43f947856a6ce58fb5b168680c53fd7652f63f46 (diff) | |
download | PSP.git-39a34b99185b3c046fb4427d07dd333575962e29.tar.gz PSP.git-39a34b99185b3c046fb4427d07dd333575962e29.tar.xz PSP.git-39a34b99185b3c046fb4427d07dd333575962e29.zip |
A lot of text bugfixes
Diffstat (limited to 'Project/OpenGLText.h')
-rw-r--r-- | Project/OpenGLText.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Project/OpenGLText.h b/Project/OpenGLText.h new file mode 100644 index 0000000..c07dab1 --- /dev/null +++ b/Project/OpenGLText.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * 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 2 of the License, or + * 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 <https://www.gnu.org/licenses/>. + */ + +#ifndef OPENGLTEXT_H +#define OPENGLTEXT_H + +#include <GL/gl.h> +#include <wx/dcmemory.h> + +/** + * @class OpenGLText + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 24/10/2017 + * @brief Class to draw text on OpenGL using wxWidgets. + * @file OpenGLText.h + */ +class OpenGLText +{ + public: + OpenGLText(); + OpenGLText(wxString text); + virtual ~OpenGLText(); + + virtual void Draw(wxPoint2DDouble position) const; + virtual OpenGLText* GetCopy(); + + virtual void SetText(wxString text); + virtual wxString GetText() const { return m_text; } + virtual int GetWidth() const { return m_bitmapSize.GetWidth(); } + virtual int GetHeight() const { return m_bitmapSize.GetHeight(); } + protected: + void Init(); + int RoundToPowerOfTwo(int value, int min = 32); + void TextToBitmap(); + void LoadTextTexture(); + + wxString m_text = _("Text"); + int m_fontSize = 10; + + wxBitmap m_bitmap = wxNullBitmap; + wxSize m_bitmapSize = wxSize(0, 0); + wxPoint2DDouble* m_textCoord = NULL; + GLuint* m_textureID = NULL; +}; + +#endif // OPENGLTEXT_H |