aboutsummaryrefslogtreecommitdiff
path: root/scene/2d/tile_map.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2015-05-01 23:20:41 -0300
committerJuan Linietsky2015-05-01 23:20:41 -0300
commitdda60296d81edaabfdb56f47a2c949b5dad283fb (patch)
treeb41e31cc4620689a1e91adf852d0926fc600607a /scene/2d/tile_map.cpp
parentfb8b740fcb50dc38526b458af096b72d1303d3e5 (diff)
parent61e90385f6cbeebb8d3d03c33078802c2fa11eda (diff)
downloadgodot-dda60296d81edaabfdb56f47a2c949b5dad283fb.tar.gz
godot-dda60296d81edaabfdb56f47a2c949b5dad283fb.tar.zst
godot-dda60296d81edaabfdb56f47a2c949b5dad283fb.zip
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r--scene/2d/tile_map.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 18f8b5bbb..bf1677ae6 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 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 */
@@ -348,8 +348,8 @@ void TileMap::_update_dirty_quadrants() {
rect.pos=offset.floor();
rect.size=s;
- rect.size.x+=fp_adjust;
- rect.size.y+=fp_adjust;
+ /* rect.size.x+=fp_adjust;
+ rect.size.y+=fp_adjust;*/
if (c.flip_h)
rect.size.x=-rect.size.x;
@@ -1024,6 +1024,19 @@ bool TileMap::is_y_sort_mode_enabled() const {
return y_sort_mode;
}
+Array TileMap::get_used_cells() const {
+
+ Array a;
+ a.resize(tile_map.size());
+ int i=0;
+ for (Map<PosKey,Cell>::Element *E=tile_map.front();E;E=E->next()) {
+
+ Vector2 p (E->key().x,E->key().y);
+ a[i++]=p;
+ }
+
+ return a;
+}
void TileMap::_bind_methods() {
@@ -1080,6 +1093,8 @@ void TileMap::_bind_methods() {
ObjectTypeDB::bind_method(_MD("clear"),&TileMap::clear);
+ ObjectTypeDB::bind_method(_MD("get_used_cells"),&TileMap::get_used_cells);
+
ObjectTypeDB::bind_method(_MD("map_to_world","mappos","ignore_half_ofs"),&TileMap::map_to_world,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("world_to_map","worldpos"),&TileMap::world_to_map);
@@ -1139,8 +1154,7 @@ TileMap::TileMap() {
navigation=NULL;
y_sort_mode=false;
- fp_adjust=0.01;
- fp_adjust=0.01;
+ fp_adjust=0.00001;
tile_origin=TILE_ORIGIN_TOP_LEFT;
}