Staircases
This commit is contained in:
@ -21,7 +21,7 @@ from kivy.core.window import Window
|
||||
from kivy.graphics import Color,Line,Rectangle
|
||||
|
||||
from point import Point
|
||||
from polyomino import Cross,Disk
|
||||
from polyomino import Cross,Disk,Staircase
|
||||
|
||||
from tools import remove_fromlist
|
||||
|
||||
@ -536,8 +536,12 @@ class Painter(Widget):
|
||||
# save state (particle shape, zoom, lattice)
|
||||
if self.shape==Cross:
|
||||
ff.write("%shape=cross\n")
|
||||
else:
|
||||
elif self.shape==Disk:
|
||||
ff.write("%shape=disk\n")
|
||||
elif self.shape==Staircase:
|
||||
ff.write("%shape=staircase\n")
|
||||
else:
|
||||
print("bug: unrecognized shape in write: '"+str(self.shape)+"'")
|
||||
ff.write("%zoom={:1.1f}\n".format(self.base_size/50))
|
||||
ff.write("%color={:d},{:d},{:d}\n".format(self.color[0],self.color[1],self.color[2]))
|
||||
if self.lattice != None:
|
||||
@ -547,6 +551,8 @@ class Painter(Widget):
|
||||
ff.write("{:d};".format(CROSS_INDEX))
|
||||
elif type(particle)==Disk:
|
||||
ff.write("{:d};".format(DISK_INDEX))
|
||||
elif type(particle)==Staircase:
|
||||
ff.write("{:d};".format(STAIRCASE_INDEX))
|
||||
ff.write("{:05.2f},{:05.2f};{:3.1f},{:3.1f},{:3.1f}\n".format(particle.elements[0].pos.x,particle.elements[0].pos.y,particle.color[0],particle.color[1],particle.color[2]))
|
||||
ff.close()
|
||||
|
||||
@ -649,6 +655,8 @@ class Painter(Widget):
|
||||
candidate=Cross(pos.x,pos.y,color=color)
|
||||
elif particle_type==DISK_INDEX:
|
||||
candidate=Disk(pos.x,pos.y,color=color)
|
||||
elif particle_type==STAIRCASE_INDEX:
|
||||
candidate=Staircase(pos.x,pos.y,color=color)
|
||||
else:
|
||||
print("warning: ignoring line "+str(i)+" in file '"+file+"': unrecognized particle type: '"+entries[0]+"'",file=sys.stderr)
|
||||
continue
|
||||
@ -702,5 +710,6 @@ class Painter(Widget):
|
||||
# global variables (used like precompiler variables)
|
||||
CROSS_INDEX=1
|
||||
DISK_INDEX=2
|
||||
STAIRCASE_INDEX=2
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user