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  BaseSurface *getSurface();
43  void cleanup();
44  void setDefaults();
45  DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder)
46 
47  bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = Graphics::kDefaultZoomX, float scaleY = Graphics::kDefaultZoomY);
48  int32 _moveY;
49  int32 _moveX;
50  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);
51  bool getCurrentFrame(float zoomX = Graphics::kDefaultZoomX, float zoomY = Graphics::kDefaultZoomY);
52  void reset();
53  bool isChanged();
54  bool isFinished();
55  bool loadBuffer(char *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
56  bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
57  bool draw(int x, int y, BaseObject *Register = nullptr, float zoomX = Graphics::kDefaultZoomX, float zoomY = Graphics::kDefaultZoomY, uint32 alpha = Graphics::kDefaultRgbaMod);
58  bool _looping;
59  int32 _currentFrame;
60  bool addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, Rect32 *rect = nullptr);
61  BaseSprite(BaseGame *inGame, BaseObject *owner = nullptr);
62  ~BaseSprite() override;
63  BaseArray<BaseFrame *> _frames;
64  bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
65 
66  // scripting interface
67  ScValue *scGetProperty(const Common::String &name) override;
68  bool scSetProperty(const char *name, ScValue *value) override;
69  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
70  const char *scToString() override;
71  Common::String debuggerToString() const override;
72 private:
73  BaseObject *_owner;
74  bool _canBreak;
75  bool _changed;
76  bool _editorAllFrames;
77  char *_editorBgFile;
78  int32 _editorBgOffsetX;
79  int32 _editorBgOffsetY;
80  int32 _editorBgAlpha;
81  bool _editorMuted;
82  bool _finished;
83  bool _continuous;
84  uint32 _lastFrameTime;
85  bool _precise;
86  bool _paused;
87  bool _streamed;
88  bool _streamedKeepLoaded;
89  bool killAllSounds();
90 };
91 
92 } // End of namespace Wintermute
93 
94 #endif
Definition: script.h:44
Definition: base_game.h:76
Definition: script_value.h:42
Definition: str.h:59
Definition: base_dynamic_buffer.h:35
Definition: rect32.h:60
Definition: script_stack.h:41
Definition: base_surface.h:38
Definition: base_script_holder.h:37
Definition: coll_templ.h:63
Definition: base_sprite.h:40
Definition: base_object.h:49
Definition: achievements_tables.h:27