ScummVM API documentation
base_sprite.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * This file is based on WME Lite.
24 * http://dead-code.org/redir.php?target=wmelite
25 * Copyright (c) 2011 Jan Nedoma
26 */
27
28#ifndef WINTERMUTE_BASE_SPRITE_H
29#define WINTERMUTE_BASE_SPRITE_H
30
31
32#include "engines/wintermute/coll_templ.h"
33#include "engines/wintermute/base/base_script_holder.h"
34#include "graphics/transform_tools.h"
35
36namespace Wintermute {
37class BaseFrame;
38class BaseSurface;
39class BaseObject;
41public:
42 bool killAllSounds();
43 BaseSurface *getSurface();
44 char *_editorBgFile;
45 int32 _editorBgOffsetX;
46 int32 _editorBgOffsetY;
47 int32 _editorBgAlpha;
48 bool _streamed;
49 bool _streamedKeepLoaded;
50 void cleanup();
51 void setDefaults();
52 bool _precise;
53 DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder)
54
55 bool _editorAllFrames;
56 bool getBoundingRect(Common::Rect32 *rect, int x, int y, float scaleX = Graphics::kDefaultZoomX, float scaleY = Graphics::kDefaultZoomY);
57 int32 _moveY;
58 int32 _moveX;
59 bool display(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = Graphics::kDefaultZoomX, float zoomY = Graphics::kDefaultZoomY, uint32 alpha = Graphics::kDefaultRgbaMod, float rotate = Graphics::kDefaultAngle, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL);
60 bool getCurrentFrame(float zoomX = Graphics::kDefaultZoomX, float zoomY = Graphics::kDefaultZoomY);
61 bool _canBreak{};
62 bool _editorMuted;
63 bool _continuous;
64 void reset();
65 BaseObject *_owner;
66 bool _changed;
67 bool _paused;
68 bool _finished;
69 bool loadBuffer(char *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
70 bool loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
71 uint32 _lastFrameTime;
72 bool draw(int x, int y, BaseObject *registerVal = nullptr, float zoomX = Graphics::kDefaultZoomX, float zoomY = Graphics::kDefaultZoomY, uint32 alpha = Graphics::kDefaultRgbaMod);
73 bool _looping;
74 int32 _currentFrame;
75 bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Common::Rect32 *rect = nullptr);
76 BaseSprite(BaseGame *inGame, BaseObject *owner = nullptr);
77 ~BaseSprite() override;
79 bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
80
81 // scripting interface
82 ScValue *scGetProperty(const char *name) override;
83 bool scSetProperty(const char *name, ScValue *value) override;
84 bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
85 const char *scToString() override;
86
87 Common::String debuggerToString() const override;
88};
89
90} // End of namespace Wintermute
91
92#endif
Definition: str.h:59
Definition: coll_templ.h:345
Definition: base_dynamic_buffer.h:35
Definition: base_game.h:79
Definition: base_object.h:49
Definition: base_script_holder.h:37
Definition: base_sprite.h:40
Definition: base_surface.h:37
Definition: script.h:44
Definition: script_stack.h:41
Definition: script_value.h:42
const int32 kDefaultZoomX
Definition: transform_struct.h:66
Definition: rect.h:538