diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/tile_map.cpp | 25 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 11 | ||||
-rw-r--r-- | scene/main/viewport.h | 1 |
3 files changed, 31 insertions, 6 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 57424d6654..c8711f10ac 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -97,6 +97,7 @@ void TileMap::set_tileset(const Ref<TileSet>& p_tileset) { clear(); _recreate_quadrants(); + emit_signal("settings_changed"); } @@ -112,6 +113,7 @@ void TileMap::set_cell_size(int p_size) { _clear_quadrants(); cell_size=p_size; _recreate_quadrants(); + emit_signal("settings_changed"); } @@ -126,6 +128,7 @@ void TileMap::set_quadrant_size(int p_size) { _clear_quadrants(); quadrant_size=p_size; _recreate_quadrants(); + emit_signal("settings_changed"); } int TileMap::get_quadrant_size() const { @@ -137,6 +140,8 @@ void TileMap::set_center_x(bool p_enable) { center_x=p_enable; _recreate_quadrants(); + emit_signal("settings_changed"); + } bool TileMap::get_center_x() const { @@ -147,6 +152,7 @@ void TileMap::set_center_y(bool p_enable) { center_y=p_enable; _recreate_quadrants(); + emit_signal("settings_changed"); } bool TileMap::get_center_y() const { @@ -234,14 +240,20 @@ void TileMap::_update_dirty_quadrants() { Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id); Matrix32 xform; - xform.set_origin(offset.floor()+shape_ofs); + xform.set_origin(offset.floor()); if (c.flip_h) { xform.elements[0]=-xform.elements[0]; - xform.elements[2].x+=s.x; + xform.elements[2].x+=s.x-shape_ofs.x; + } else { + + xform.elements[2].x+=shape_ofs.x; } if (c.flip_v) { xform.elements[1]=-xform.elements[1]; - xform.elements[2].y+=s.y; + xform.elements[2].y+=s.y-shape_ofs.y; + } else { + + xform.elements[2].y+=shape_ofs.y; } @@ -483,8 +495,9 @@ void TileMap::_set_tile_data(const DVector<int>& p_data) { SWAP(local[4],local[7]); SWAP(local[5],local[6]); #endif - int x = decode_uint16(&local[0]); - int y = decode_uint16(&local[2]); + + int16_t x = decode_uint16(&local[0]); + int16_t y = decode_uint16(&local[2]); uint32_t v = decode_uint32(&local[4]); bool flip_h = v&(1<<29); bool flip_v = v&(1<<30); @@ -571,6 +584,8 @@ void TileMap::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"tile_set",PROPERTY_HINT_RESOURCE_TYPE,"TileSet"),_SCS("set_tileset"),_SCS("get_tileset")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"tile_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_tile_data"),_SCS("_get_tile_data")); + ADD_SIGNAL(MethodInfo("settings_changed")); + BIND_CONSTANT( INVALID_CELL ); } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index c13b4eb060..0bbc2dc695 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -67,16 +67,25 @@ bool RenderTargetTexture::has_alpha() const{ void RenderTargetTexture::set_flags(uint32_t p_flags){ + ERR_FAIL_COND(!vp); + if (p_flags&FLAG_FILTER) + flags=FLAG_FILTER; + else + flags=0; + + VS::get_singleton()->texture_set_flags(vp->render_target_texture_rid,flags); } + uint32_t RenderTargetTexture::get_flags() const{ - return 0; + return flags; } RenderTargetTexture::RenderTargetTexture(Viewport *p_vp){ vp=p_vp; + flags=0; } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 178a7517f0..cc7f93cfa3 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -45,6 +45,7 @@ class RenderTargetTexture : public Texture { OBJ_TYPE( RenderTargetTexture, Texture ); + int flags; friend class Viewport; Viewport *vp; |