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 
36 namespace Wintermute {
37 class BaseFrame;
38 class BaseSurface;
39 class BaseObject;
41 public:
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 isChanged();
67  bool _paused;
68  bool isFinished();
69  bool loadBuffer(char *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
70  bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
71  uint32 _lastFrameTime;
72  bool draw(int x, int y, BaseObject *Register = 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;
78  BaseArray<BaseFrame *> _frames;
79  bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
80 
81  // scripting interface
82  ScValue *scGetProperty(const Common::String &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  Common::String debuggerToString() const override;
87 private:
88  bool _changed;
89  bool _finished;
90 };
91 
92 } // End of namespace Wintermute
93 
94 #endif
Definition: script.h:44
Definition: base_game.h:75
Definition: rect.h:526
Definition: script_value.h:42
Definition: str.h:59
Definition: base_dynamic_buffer.h:35
Definition: script_stack.h:41
Definition: base_surface.h:37
Definition: base_script_holder.h:37
Definition: coll_templ.h:347
Definition: base_sprite.h:40
Definition: base_object.h:49
Definition: achievements_tables.h:27