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 // 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. // This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information. // 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 { 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()) { if (!charBounds.isEmpty()) {
ScopedSurfaceLock lock(commonFont->getSurfaceSheet()); ScopedSurfaceLock lock(ssFont->getSurfaceSheet());
drawColoredRgbaSurface(lock, fg, bg, gfx::Clip(x, y, charBounds)); 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. // This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information. // Read LICENSE.txt for more information.
#ifndef SHE_COMMON_FONT_H #ifndef SHE_SPRITE_SHEET_FONT_H
#define SHE_COMMON_FONT_H #define SHE_SPRITE_SHEET_FONT_H
#pragma once #pragma once
#include "base/debug.h" #include "base/debug.h"
@ -20,13 +20,13 @@
namespace she { namespace she {
class CommonFont : public Font { class SpriteSheetFont : public Font {
public: public:
CommonFont() : m_sheet(nullptr) { SpriteSheetFont() : m_sheet(nullptr) {
} }
~CommonFont() { ~SpriteSheetFont() {
ASSERT(m_sheet); ASSERT(m_sheet);
m_sheet->dispose(); m_sheet->dispose();
} }
@ -74,7 +74,7 @@ public:
} }
static Font* fromSurface(Surface* sur) { static Font* fromSurface(Surface* sur) {
CommonFont* font = new CommonFont; SpriteSheetFont* font = new SpriteSheetFont;
font->m_sheet = sur; font->m_sheet = sur;
ScopedSurfaceLock surLock(sur); ScopedSurfaceLock surLock(sur);

View File

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

View File

@ -1,5 +1,5 @@
// SHE library // 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. // This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information. // Read LICENSE.txt for more information.
@ -9,7 +9,7 @@
#pragma once #pragma once
#include "gfx/clip.h" #include "gfx/clip.h"
#include "she/common/font.h" #include "she/common/sprite_sheet_font.h"
#include "she/locked_surface.h" #include "she/locked_surface.h"
#include "she/scoped_surface_lock.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 { 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); gfx::Rect charBounds = commonFont->getCharBounds(chr);
if (!charBounds.isEmpty()) { if (!charBounds.isEmpty()) {