2011-07-03 19:26:27 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-02-18 02:34:22 +01:00
|
|
|
*
|
2011-07-03 19:26:27 +00:00
|
|
|
* 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.
|
2014-02-18 02:34:22 +01:00
|
|
|
*
|
2011-07-03 19:26:27 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-07-03 19:26:27 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "neverhood/background.h"
|
|
|
|
|
|
|
|
namespace Neverhood {
|
|
|
|
|
|
|
|
// Background
|
|
|
|
|
|
|
|
Background::Background(NeverhoodEngine *vm, int objectPriority)
|
2021-11-13 23:40:34 +02:00
|
|
|
: Entity(vm, objectPriority), _surface(nullptr), _spriteResource(vm) {
|
2011-07-03 19:26:27 +00:00
|
|
|
// Empty
|
|
|
|
}
|
|
|
|
|
|
|
|
Background::Background(NeverhoodEngine *vm, uint32 fileHash, int objectPriority, int surfacePriority)
|
2021-11-13 23:40:34 +02:00
|
|
|
: Entity(vm, objectPriority), _surface(nullptr), _spriteResource(vm) {
|
2013-07-14 19:01:47 +02:00
|
|
|
|
2011-07-03 19:26:27 +00:00
|
|
|
_spriteResource.load(fileHash);
|
|
|
|
createSurface(surfacePriority, _spriteResource.getDimensions().width, _spriteResource.getDimensions().height);
|
|
|
|
_surface->drawSpriteResource(_spriteResource);
|
2013-07-14 19:01:47 +02:00
|
|
|
|
2011-07-03 19:26:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Background::createSurface(int surfacePriority, int16 width, int16 height) {
|
2023-01-19 02:16:51 +01:00
|
|
|
_surface .reset(new BaseSurface(_vm, surfacePriority, width, height, "background"));
|
2011-07-06 11:01:21 +00:00
|
|
|
_surface->setTransparent(false);
|
2011-07-03 19:26:27 +00:00
|
|
|
_spriteResource.getPosition().x = width;
|
|
|
|
_spriteResource.getPosition().y = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Background::load(uint32 fileHash) {
|
|
|
|
_spriteResource.load(fileHash);
|
|
|
|
if (_surface)
|
|
|
|
_surface->drawSpriteResource(_spriteResource);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Neverhood
|