Rename she::CommonFont to SpriteSheetFont

This commit is contained in:
David Capello 2016-03-07 17:39:02 -03:00
parent 75203037e2
commit 97f1d0f895
4 changed files with 16 additions and 16 deletions

View File

@ -1,5 +1,5 @@
// SHE library
// Copyright (C) 2012-2015 David Capello
// Copyright (C) 2012-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -90,11 +90,11 @@ public:
}
void drawChar(Font* font, gfx::Color fg, gfx::Color bg, int x, int y, int chr) override {
CommonFont* commonFont = static_cast<CommonFont*>(font);
SpriteSheetFont* ssFont = static_cast<SpriteSheetFont*>(font);
gfx::Rect charBounds = commonFont->getCharBounds(chr);
gfx::Rect charBounds = ssFont->getCharBounds(chr);
if (!charBounds.isEmpty()) {
ScopedSurfaceLock lock(commonFont->getSurfaceSheet());
ScopedSurfaceLock lock(ssFont->getSurfaceSheet());
drawColoredRgbaSurface(lock, fg, bg, gfx::Clip(x, y, charBounds));
}
}

View File

@ -4,8 +4,8 @@
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef SHE_COMMON_FONT_H
#define SHE_COMMON_FONT_H
#ifndef SHE_SPRITE_SHEET_FONT_H
#define SHE_SPRITE_SHEET_FONT_H
#pragma once
#include "base/debug.h"
@ -20,13 +20,13 @@
namespace she {
class CommonFont : public Font {
class SpriteSheetFont : public Font {
public:
CommonFont() : m_sheet(nullptr) {
SpriteSheetFont() : m_sheet(nullptr) {
}
~CommonFont() {
~SpriteSheetFont() {
ASSERT(m_sheet);
m_sheet->dispose();
}
@ -74,7 +74,7 @@ public:
}
static Font* fromSurface(Surface* sur) {
CommonFont* font = new CommonFont;
SpriteSheetFont* font = new SpriteSheetFont;
font->m_sheet = sur;
ScopedSurfaceLock surLock(sur);

View File

@ -1,5 +1,5 @@
// SHE library
// Copyright (C) 2012-2015 David Capello
// Copyright (C) 2012-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -19,7 +19,7 @@
#include "she/native_dialogs.h"
#endif
#include "she/common/font.h"
#include "she/common/sprite_sheet_font.h"
namespace she {
@ -75,7 +75,7 @@ public:
Font* font = nullptr;
if (sheet) {
sheet->applyScale(scale);
font = CommonFont::fromSurface(sheet);
font = SpriteSheetFont::fromSurface(sheet);
}
return font;
}

View File

@ -1,5 +1,5 @@
// SHE library
// Copyright (C) 2012-2015 David Capello
// Copyright (C) 2012-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -9,7 +9,7 @@
#pragma once
#include "gfx/clip.h"
#include "she/common/font.h"
#include "she/common/sprite_sheet_font.h"
#include "she/locked_surface.h"
#include "she/scoped_surface_lock.h"
@ -433,7 +433,7 @@ public:
}
void drawChar(Font* font, gfx::Color fg, gfx::Color bg, int x, int y, int chr) override {
CommonFont* commonFont = static_cast<CommonFont*>(font);
SpriteSheetFont* commonFont = static_cast<SpriteSheetFont*>(font);
gfx::Rect charBounds = commonFont->getCharBounds(chr);
if (!charBounds.isEmpty()) {