SDL_Rect find_map_rect(Idevice& input, Viewpoint& camera) { SDL_Rect tilerect; int tilex, tiley; tilex = (input.get_x() + camera.get_x()) / TILEW; tiley = (input.get_y() + camera.get_y()) / TILEH; tilerect.x = tilex * TILEW; tilerect.y = tiley * TILEH; tilerect.w = TILEW; tilerect.h = TILEH; return tilerect; }
int tile_x(Idevice& input, Viewpoint& camera) { int tilex = (input.get_x() + camera.get_x()) / TILEW; return tilex; }