<s> from math . rect import Rect <EOL> class Texture : <EOL> def __init__ ( self , width , height , name = "<STR_LIT>" ) : <EOL> self . width = width <EOL> self . height = height <EOL> self . x = <NUM_LIT:0> <EOL> self . y = <NUM_LIT:0> <EOL> self . area = width * height <EOL> self . flipped = False <EOL> self . placed = False <EOL> self . longestEdge = width if width > height else height <EOL> self . name = name <EOL> def place_texture ( self , x , y , flipped = False ) : <EOL> self . x = x <EOL> self . y = y <EOL> self . flipped = flipped <EOL> self . placed = True <EOL> def flip_dimensions ( self ) : <EOL> if ( self . flipped ) : <EOL> tmp = self . width <EOL> self . width = self . height <EOL> self . height = tmp <EOL> def to_dict ( self ) : <EOL> tex_dict = { } <EOL> tex_dict [ '<STR_LIT:width>' ] = self . width <EOL> tex_dict [ '<STR_LIT>' ] = self . height <EOL> tex_dict [ '<STR_LIT:x>' ] = self . x <EOL> tex_dict [ '<STR_LIT:y>' ] = self . y <EOL> tex_dict [ '<STR_LIT>' ] = self . flipped <EOL> tex_dict [ '<STR_LIT:name>' ] = self . name <EOL> return tex_dict <EOL> def get_rect ( self ) : <EOL> return Rect ( self . x , self . y , self . x + self . width , self . y + self . height ) </s>
