V-Gears 0
Free Final Fantasy VII engine.
VGearsPaletteFile.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <OgreColourValue.h>
19#include <OgreResource.h>
20#include "common/TypeDefine.h"
21
22namespace VGears{
23
27 class PaletteFile : public Ogre::Resource{
28
29 public:
30
50 Ogre::ResourceManager* creator, const String &name,
51 Ogre::ResourceHandle handle, const String& group,
52 bool is_manual = false,
53 Ogre::ManualResourceLoader* loader = nullptr
54 );
55
59 virtual ~PaletteFile();
60
64 static const String RESOURCE_TYPE;
65
66 typedef Ogre::ColourValue Color;
67
68 typedef std::vector<Color> Page;
69
70 typedef std::vector<Page> PageList;
71
77 virtual PageList& GetPages(){return pages_;}
78
85 virtual const Page& GetPage(size_t index) const{
86 return pages_.at(index);
87 }
88
89 protected:
90
94 virtual void loadImpl() override;
95
99 virtual void unloadImpl() override;
100
107 virtual size_t calculateSize() const override;
108
109 private:
110
115 };
116
117 typedef Ogre::SharedPtr<PaletteFile> PaletteFilePtr;
118}
Handles colour palette files.
Definition: VGearsPaletteFile.h:27
virtual void unloadImpl() override
Unloads the file.
Definition: VGearsPaletteFile.cpp:46
std::vector< Color > Page
Definition: VGearsPaletteFile.h:68
Ogre::ColourValue Color
Definition: VGearsPaletteFile.h:66
PaletteFile(Ogre::ResourceManager *creator, const String &name, Ogre::ResourceHandle handle, const String &group, bool is_manual=false, Ogre::ManualResourceLoader *loader=nullptr)
Constructor.
Definition: VGearsPaletteFile.cpp:26
virtual void loadImpl() override
Loads the file.
Definition: VGearsPaletteFile.cpp:36
static const String RESOURCE_TYPE
The type of resource.
Definition: VGearsPaletteFile.h:64
virtual PageList & GetPages()
Retrieevs the list of pages.
Definition: VGearsPaletteFile.h:77
virtual ~PaletteFile()
Destructor.
Definition: VGearsPaletteFile.cpp:34
virtual const Page & GetPage(size_t index) const
Retrieves a page.
Definition: VGearsPaletteFile.h:85
std::vector< Page > PageList
Definition: VGearsPaletteFile.h:70
virtual size_t calculateSize() const override
Calculates the size of the palette.
Definition: VGearsPaletteFile.cpp:48
PageList pages_
The list of palette pages.
Definition: VGearsPaletteFile.h:114
Definition: FF7NameLookup.h:24
Ogre::String String
Definition: TypeDefine.h:37
Ogre::SharedPtr< PaletteFile > PaletteFilePtr
Definition: VGearsPaletteFile.h:117