mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Added 'position hint' to packages, used to specify the order of the packages in a package list;
Added 'pack type', intended for playtesting (random boosters/starters); Added 'default(_image)' property to ImageStyle, and added the frame fillers for magic; Added blurring and bold printing (rather hacky) to the text rendering functions (used for "double click to add image" text); Added 'symmetric overlay' combine mode, which will look really nice for hybrids; Moved the watermark choices from the game to an include file in magic-watermarks; Working on a replacement for the image scripting system that plays nicer with the rest of the code. In particular, it will be possible to compare generated images quickly, so they can be updated continuously. This is a work in progress, currently there are two versions of everything. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@327 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+49
-2
@@ -13,13 +13,60 @@
|
||||
#include <util/age.hpp>
|
||||
#include <util/dynamic_arg.hpp>
|
||||
#include <script/scriptable.hpp>
|
||||
#include <gfx/gfx.hpp>
|
||||
//%%#include <gfx/gfx.hpp>
|
||||
#include <gfx/generated_image.hpp>
|
||||
|
||||
class Package;
|
||||
DECLARE_INTRUSIVE_POINTER_TYPE(ScriptImage);
|
||||
DECLARE_INTRUSIVE_POINTER_TYPE(ScriptImage); //%% OLD
|
||||
DECLARE_INTRUSIVE_POINTER_TYPE(GeneratedImage); //%% OLD
|
||||
|
||||
// ----------------------------------------------------------------------------- : ScriptableImage
|
||||
|
||||
/// An image that can also be scripted
|
||||
/** Differs from Scriptable<Image> in that:
|
||||
* - A script is always used
|
||||
* - Age is checked, chached images are used if possible
|
||||
* - The image can be scaled
|
||||
*/
|
||||
class ScriptableImage2 {
|
||||
public:
|
||||
inline ScriptableImage2() {}
|
||||
inline ScriptableImage2(const String& script) : script(script) {}
|
||||
|
||||
/// Is there an image set?
|
||||
inline bool isScripted() const { return script; }
|
||||
/// Is there an image generator available?
|
||||
inline bool isReady() const { return value; }
|
||||
|
||||
/// Generate an image.
|
||||
Image generate(const GeneratedImage::Options& options, bool cache = false) const;
|
||||
/// How should images be combined with the background?
|
||||
ImageCombine combine() const;
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
inline void initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
private:
|
||||
OptionalScript script; ///< The script, not really optional
|
||||
GeneratedImageP value; ///< The image generator
|
||||
mutable Image cached; ///< The cached actual image
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
/// Missing for now
|
||||
inline ScriptValueP to_script(const ScriptableImage2&) { return script_nil; }
|
||||
|
||||
/// Convert a script value to a GeneratedImageP
|
||||
GeneratedImageP image_from_script(const ScriptValueP& value);
|
||||
|
||||
// ----------------------------------------------------------------------------- : ScriptableImage
|
||||
//%% OLD
|
||||
|
||||
DECLARE_DYNAMIC_ARG(Package*, load_images_from);
|
||||
|
||||
/// An image, returned by a script function
|
||||
|
||||
Reference in New Issue
Block a user