2022-03-17 22:33:22 +01:00
|
|
|
#ifndef PROP_2D_DATA_SPRITE_H
|
|
|
|
#define PROP_2D_DATA_SPRITE_H
|
2023-12-17 22:59:50 +01:00
|
|
|
|
2023-12-18 00:18:53 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* prop_2d_data_sprite.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* PANDEMONIUM ENGINE */
|
|
|
|
/* https://github.com/Relintai/pandemonium_engine */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* Copyright (c) 2022-present Péter Magyar. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2022-03-15 13:29:32 +01:00
|
|
|
|
2022-08-17 11:38:15 +02:00
|
|
|
#include "core/math/color.h"
|
2022-03-15 13:29:32 +01:00
|
|
|
|
|
|
|
#include "scene/resources/texture.h"
|
|
|
|
|
|
|
|
#include "prop_2d_data_entry.h"
|
|
|
|
|
|
|
|
class Prop2DDataSprite : public Prop2DDataEntry {
|
|
|
|
GDCLASS(Prop2DDataSprite, Prop2DDataEntry);
|
|
|
|
|
|
|
|
public:
|
|
|
|
Ref<Texture> get_texture() const;
|
|
|
|
void set_texture(const Ref<Texture> &value);
|
|
|
|
|
|
|
|
Ref<Texture> get_normal_map() const;
|
|
|
|
void set_normal_map(const Ref<Texture> &value);
|
|
|
|
|
|
|
|
bool get_centered() const;
|
|
|
|
void set_centered(const bool value);
|
|
|
|
|
|
|
|
Vector2 get_offset() const;
|
|
|
|
void set_offset(const Vector2 &value);
|
|
|
|
|
|
|
|
bool get_flip_h() const;
|
|
|
|
void set_flip_h(const bool value);
|
|
|
|
|
|
|
|
bool get_flip_v() const;
|
|
|
|
void set_flip_v(const bool value);
|
|
|
|
|
|
|
|
int get_animation_h_frames() const;
|
|
|
|
void set_animation_h_frames(const int value);
|
|
|
|
|
|
|
|
int get_animation_v_frames() const;
|
|
|
|
void set_animation_v_frames(const int value);
|
|
|
|
|
|
|
|
int get_animation_frame() const;
|
|
|
|
void set_animation_frame(const int value);
|
|
|
|
|
|
|
|
Vector2 get_animation_frame_coords() const;
|
|
|
|
void set_animation_frame_coords(const Vector2 &value);
|
|
|
|
|
|
|
|
bool get_region_enabled() const;
|
|
|
|
void set_region_enabled(const bool value);
|
|
|
|
|
|
|
|
Rect2 get_region() const;
|
|
|
|
void set_region(const Rect2 &value);
|
|
|
|
|
|
|
|
bool get_filter_clip() const;
|
|
|
|
void set_filter_clip(const bool value);
|
|
|
|
|
|
|
|
bool _processor_handles(Node *node);
|
|
|
|
void _processor_process(Ref<Prop2DData> prop_data, Node *node, const Transform2D &transform, Ref<Prop2DDataEntry> entry = Ref<Prop2DDataEntry>());
|
|
|
|
Node *_processor_get_node_for(const Transform2D &transform, Node *node = nullptr);
|
|
|
|
|
|
|
|
Prop2DDataSprite();
|
|
|
|
~Prop2DDataSprite();
|
|
|
|
|
|
|
|
protected:
|
2023-06-17 02:20:24 +02:00
|
|
|
#ifndef DISABLE_DEPRECATED
|
|
|
|
// TODO REMOVE AFTER NEXT RELEASE
|
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
#endif
|
2022-03-15 13:29:32 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ref<Texture> _texture;
|
|
|
|
Ref<Texture> _normal_map;
|
|
|
|
|
|
|
|
bool _centered;
|
|
|
|
Vector2 _offset;
|
|
|
|
bool _flip_h;
|
|
|
|
bool _flip_v;
|
|
|
|
|
|
|
|
int _animation_h_frames;
|
|
|
|
int _animation_v_frames;
|
|
|
|
int _animation_frame;
|
|
|
|
Vector2 _animation_frame_coords;
|
|
|
|
|
|
|
|
bool _region_enabled;
|
|
|
|
Rect2 _region;
|
|
|
|
|
|
|
|
bool _filter_clip;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|