Skip to content

Commit 1dd3c6e

Browse files
author
Morgan Christiansson
committed
Rename to GlTexture
1 parent 295480b commit 1dd3c6e

3 files changed

Lines changed: 23 additions & 24 deletions

File tree

CGame.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "CIO/CFont.h"
99
#include "SdlSurface.h"
10-
#include "glArchivItem_BitmapBase.h"
10+
#include "GlTexture.h"
1111
#include <boost/filesystem/path.hpp>
1212
#include <Point.h>
1313
#include <memory>
@@ -46,13 +46,13 @@ class CGame
4646
Uint32 lastFrameTime = 0;
4747
unsigned suppressResizeEvents_ = 0;
4848

49-
// GL textures for backgrounds and cursor (s25client pattern)
50-
glArchivItem_BitmapBase splashBg_;
51-
glArchivItem_BitmapBase menuBgMain_;
52-
glArchivItem_BitmapBase menuBgSub_;
53-
glArchivItem_BitmapBase cursor_;
54-
glArchivItem_BitmapBase cursorClicked_;
55-
glArchivItem_BitmapBase cross_;
49+
// GL textures for backgrounds and cursor
50+
GlTexture splashBg_;
51+
GlTexture menuBgMain_;
52+
GlTexture menuBgSub_;
53+
GlTexture cursor_;
54+
GlTexture cursorClicked_;
55+
GlTexture cross_;
5656

5757
// structure for mouse cursor
5858
struct
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
//
44
// SPDX-License-Identifier: GPL-3.0-or-later
55

6-
#include "glArchivItem_BitmapBase.h"
6+
#include "GlTexture.h"
77
#include <glad/glad.h>
88
#include <vector>
99

10-
glArchivItem_BitmapBase::~glArchivItem_BitmapBase()
10+
GlTexture::~GlTexture()
1111
{
1212
if(texture_)
1313
glDeleteTextures(1, &texture_);
1414
}
1515

16-
glArchivItem_BitmapBase::glArchivItem_BitmapBase(glArchivItem_BitmapBase&& other) noexcept
16+
GlTexture::GlTexture(GlTexture&& other) noexcept
1717
: texture_(other.texture_), width_(other.width_), height_(other.height_)
1818
{
1919
other.texture_ = 0;
2020
other.width_ = 0;
2121
other.height_ = 0;
2222
}
2323

24-
glArchivItem_BitmapBase& glArchivItem_BitmapBase::operator=(glArchivItem_BitmapBase&& other) noexcept
24+
GlTexture& GlTexture::operator=(GlTexture&& other) noexcept
2525
{
2626
if(this != &other)
2727
{
@@ -37,7 +37,7 @@ glArchivItem_BitmapBase& glArchivItem_BitmapBase::operator=(glArchivItem_BitmapB
3737
return *this;
3838
}
3939

40-
void glArchivItem_BitmapBase::createTexture(const void* bgraPixels, int w, int h, bool linear)
40+
void GlTexture::createTexture(const void* bgraPixels, int w, int h, bool linear)
4141
{
4242
if(texture_)
4343
glDeleteTextures(1, &texture_);
@@ -55,7 +55,7 @@ void glArchivItem_BitmapBase::createTexture(const void* bgraPixels, int w, int h
5555
height_ = h;
5656
}
5757

58-
bool glArchivItem_BitmapBase::load(SDL_Surface* surface, bool linear)
58+
bool GlTexture::load(SDL_Surface* surface, bool linear)
5959
{
6060
if(!surface)
6161
return false;
@@ -114,7 +114,7 @@ bool glArchivItem_BitmapBase::load(SDL_Surface* surface, bool linear)
114114
return true;
115115
}
116116

117-
void glArchivItem_BitmapBase::DrawFull(const Rect& destRect) const
117+
void GlTexture::DrawFull(const Rect& destRect) const
118118
{
119119
if(!texture_)
120120
return;
@@ -132,7 +132,7 @@ void glArchivItem_BitmapBase::DrawFull(const Rect& destRect) const
132132
glEnd();
133133
}
134134

135-
void glArchivItem_BitmapBase::Draw(int x, int y) const
135+
void GlTexture::Draw(int x, int y) const
136136
{
137137
if(!texture_)
138138
return;
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88
#include "Rect.h"
99
#include <SDL.h>
1010

11-
/// Mirrors s25client's glArchivItem_BitmapBase pattern.
1211
/// Wraps a GL texture with RAII and provides draw methods.
13-
class glArchivItem_BitmapBase
12+
class GlTexture
1413
{
1514
public:
16-
glArchivItem_BitmapBase() = default;
17-
~glArchivItem_BitmapBase();
15+
GlTexture() = default;
16+
~GlTexture();
1817

19-
glArchivItem_BitmapBase(glArchivItem_BitmapBase&&) noexcept;
20-
glArchivItem_BitmapBase& operator=(glArchivItem_BitmapBase&&) noexcept;
18+
GlTexture(GlTexture&&) noexcept;
19+
GlTexture& operator=(GlTexture&&) noexcept;
2120

2221
// No copy
23-
glArchivItem_BitmapBase(const glArchivItem_BitmapBase&) = delete;
24-
glArchivItem_BitmapBase& operator=(const glArchivItem_BitmapBase&) = delete;
22+
GlTexture(const GlTexture&) = delete;
23+
GlTexture& operator=(const GlTexture&) = delete;
2524

2625
/// Load from a 32-bit or 8-bit paletted SDL surface.
2726
/// For 8-bit surfaces, optional colorkey is respected (keyed pixels become transparent).

0 commit comments

Comments
 (0)