ScummVM API documentation
base_sub_frame.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_SUBFRAME_H
29 #define WINTERMUTE_BASE_SUBFRAME_H
30 
31 
32 #include "engines/wintermute/base/base.h"
33 #include "engines/wintermute/base/base_scriptable.h"
34 #include "graphics/transform_struct.h"
35 
36 namespace Wintermute {
37 class BaseObject;
38 class BaseSurface;
39 class BaseSubFrame : public BaseScriptable {
40 public:
41  bool _mirrorX;
42  bool _mirrorY;
43  bool _decoration;
44  bool setSurface(const Common::String &filename, bool defaultCK = true, byte ckRed = 0, byte ckGreen = 0, byte ckBlue = 0, int lifeTime = -1, bool keepLoaded = false);
45  bool setSurfaceSimple();
46  DECLARE_PERSISTENT(BaseSubFrame, BaseScriptable)
47  void setDefaultRect();
48  uint32 _transparent;
49  bool saveAsText(BaseDynamicBuffer *buffer, int indent) override { return saveAsText(buffer, indent, true); }
50  bool saveAsText(BaseDynamicBuffer *buffer, int indent, bool complete);
51  bool _editorSelected;
52  BaseSubFrame(BaseGame *inGame);
53  ~BaseSubFrame() override;
54  bool loadBuffer(char *buffer, int lifeTime, bool keepLoaded);
55  bool draw(int x, int y, BaseObject *registerOwner = nullptr, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, Graphics::TSpriteBlendMode blendMode = Graphics::BLEND_NORMAL);
56  bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100);
57  const char* getSurfaceFilename();
58 
59  int32 _hotspotX;
60  int32 _hotspotY;
61  uint32 _alpha;
62  // These two setters and getters are rather usefull, as they allow _rect to be lazily defined
63  // Thus we don't need to load the actual graphics before the rect is actually needed.
64  Rect32 getRect();
65  void setRect(Rect32 rect);
66 private:
67  bool _wantsDefaultRect;
68  Rect32 _rect;
69  char *_surfaceFilename;
70 public:
71  bool _cKDefault;
72  byte _cKRed;
73  byte _cKGreen;
74  byte _cKBlue;
75  int32 _lifeTime;
76  bool _keepLoaded;
77 
78  bool _2DOnly;
79  bool _3DOnly;
80 
81  BaseSurface *_surface;
82 
83  // scripting interface
84  ScValue *scGetProperty(const Common::String &name) override;
85  bool scSetProperty(const char *name, ScValue *value) override;
86  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
87  const char *scToString() override;
88  Common::String debuggerToString() const override;
89 
90 };
91 
92 } // End of namespace Wintermute
93 
94 #endif
Definition: script.h:44
Definition: base_game.h:75
Definition: script_value.h:42
Definition: str.h:59
Definition: base_sub_frame.h:39
Definition: base_dynamic_buffer.h:35
Definition: base_scriptable.h:41
Definition: rect32.h:60
Definition: script_stack.h:41
Definition: base_surface.h:38
Definition: base_object.h:57
Definition: achievements_tables.h:27