added first icons, coding in progress
parent
3e81542b0e
commit
8cbf5effee
|
@ -16,6 +16,7 @@ class stdrend:
|
||||||
|
|
||||||
def coltohex(self, target):
|
def coltohex(self, target):
|
||||||
colors = []
|
colors = []
|
||||||
|
target = [target.r, target.g, target.b]
|
||||||
for i in target:
|
for i in target:
|
||||||
colors.append(("0"*(2-len(hex(i)[2:])))+hex(i)[2:])
|
colors.append(("0"*(2-len(hex(i)[2:])))+hex(i)[2:])
|
||||||
out = ""
|
out = ""
|
||||||
|
@ -28,6 +29,54 @@ class stdrend:
|
||||||
self._grid[f"{x}:{y}"].config(text=text, bg=self.coltohex(bcolor), fg=self.coltohex(fcolor))
|
self._grid[f"{x}:{y}"].config(text=text, bg=self.coltohex(bcolor), fg=self.coltohex(fcolor))
|
||||||
self._win.update()
|
self._win.update()
|
||||||
|
|
||||||
|
class color3:
|
||||||
|
def __init__(self, r=0, g=0, b=0):
|
||||||
|
self.r = r
|
||||||
|
self.g = g
|
||||||
|
self.b = b
|
||||||
|
|
||||||
|
def __add__(self, v):
|
||||||
|
temp = color3(self.r+v.r, self.g+v.g, self.b+v.b)
|
||||||
|
temp.r = temp.r%255
|
||||||
|
temp.g = temp.g%255
|
||||||
|
temp.b = temp.b%255
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def __sub__(self, v):
|
||||||
|
temp = color3(self.r-v.r, self.g-v.g, self.b-v.b)
|
||||||
|
temp.r = temp.r%255
|
||||||
|
temp.g = temp.g%255
|
||||||
|
temp.b = temp.b%255
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def __mul__(self, v):
|
||||||
|
temp = color3(self.r*v.r, self.g*v.g, self.b*v.b)
|
||||||
|
temp.r = temp.r%255
|
||||||
|
temp.g = temp.g%255
|
||||||
|
temp.b = temp.b%255
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def __iadd__(self, v):
|
||||||
|
temp = color3(self.r+v.r, self.g+v.g, self.b+v.b)
|
||||||
|
temp.r = temp.r%255
|
||||||
|
temp.g = temp.g%255
|
||||||
|
temp.b = temp.b%255
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def __isub__(self, v):
|
||||||
|
temp = color3(self.r-v.r, self.g-v.g, self.b-v.b)
|
||||||
|
temp.r = temp.r%255
|
||||||
|
temp.g = temp.g%255
|
||||||
|
temp.b = temp.b%255
|
||||||
|
return temp
|
||||||
|
|
||||||
|
def __imul__(self, v):
|
||||||
|
temp = color3(self.r*v.r, self.g*v.g, self.b*v.b)
|
||||||
|
temp.r = temp.r%255
|
||||||
|
temp.g = temp.g%255
|
||||||
|
temp.b = temp.b%255
|
||||||
|
return temp
|
||||||
|
|
||||||
class vector2:
|
class vector2:
|
||||||
def __init__(self, x=0, y=0):
|
def __init__(self, x=0, y=0):
|
||||||
self.x = x
|
self.x = x
|
||||||
|
@ -79,8 +128,8 @@ class obj:
|
||||||
self.collide = True
|
self.collide = True
|
||||||
self.touch = True
|
self.touch = True
|
||||||
self.anchored = False
|
self.anchored = False
|
||||||
self.bcolor = (255, 255, 255)
|
self.bcolor = color3(255, 255, 255)
|
||||||
self.fcolor = (0, 0, 0)
|
self.fcolor = color3()
|
||||||
|
|
||||||
class camera(obj):
|
class camera(obj):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -129,11 +178,19 @@ class game:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testgame = game()
|
testgame = game()
|
||||||
|
for i in range(10):
|
||||||
|
for f in range(10):
|
||||||
object = obj()
|
object = obj()
|
||||||
object.char = "#"
|
object.char = "#"
|
||||||
|
object.position = vector2(i, f)
|
||||||
|
object.bcolor = color3()
|
||||||
testgame.addobj(object)
|
testgame.addobj(object)
|
||||||
testgame.render()
|
testgame.render()
|
||||||
print(object.ID)
|
print(object.ID)
|
||||||
input("enter to exit")
|
while True:
|
||||||
|
for i in testgame._objects:
|
||||||
|
testgame._objects[i].fcolor += color3(1, 11, 111)
|
||||||
|
testgame._objects[i].bcolor += color3(1, 11, 111)
|
||||||
|
testgame.render()
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 192 B |
Binary file not shown.
After Width: | Height: | Size: 248 B |
27
main.py
27
main.py
|
@ -14,6 +14,33 @@ lang = lang.read()
|
||||||
LH.setlang(lang)
|
LH.setlang(lang)
|
||||||
# LH.string("")
|
# LH.string("")
|
||||||
|
|
||||||
|
class preview:
|
||||||
|
def __init__(self, size, container, offset):
|
||||||
|
self._size = size
|
||||||
|
self._grid = {}
|
||||||
|
self._win = container
|
||||||
|
for y in range(size[1]):
|
||||||
|
for x in range(size[0]):
|
||||||
|
temp = tk.Label(text=" ")
|
||||||
|
temp.grid(row=y+offset[1], column=x+offset[0])
|
||||||
|
self._win.update()
|
||||||
|
self._grid[f"{x}:{y}"] = temp
|
||||||
|
|
||||||
|
def coltohex(self, target):
|
||||||
|
colors = []
|
||||||
|
target = [target.r, target.g, target.b]
|
||||||
|
for i in target:
|
||||||
|
colors.append(("0"*(2-len(hex(i)[2:])))+hex(i)[2:])
|
||||||
|
out = ""
|
||||||
|
for i in colors:
|
||||||
|
out = out + i
|
||||||
|
return "#"+out
|
||||||
|
|
||||||
|
def pix(self, x, y, text, bcolor, fcolor):
|
||||||
|
if f"{x}:{y}" in self._grid:
|
||||||
|
self._grid[f"{x}:{y}"].config(text=text, bg=self.coltohex(bcolor), fg=self.coltohex(fcolor))
|
||||||
|
self._win.update()
|
||||||
|
|
||||||
def selectlang(new):
|
def selectlang(new):
|
||||||
lang = open("clang", 'w')
|
lang = open("clang", 'w')
|
||||||
lang.write(new)
|
lang.write(new)
|
||||||
|
|
Loading…
Reference in New Issue