added first icons, coding in progress

main
Justus Jan Nico Wolff 2024-05-10 22:09:59 +02:00
parent 3e81542b0e
commit 8cbf5effee
4 changed files with 90 additions and 6 deletions

View File

@ -16,6 +16,7 @@ class stdrend:
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 = ""
@ -28,6 +29,54 @@ class stdrend:
self._grid[f"{x}:{y}"].config(text=text, bg=self.coltohex(bcolor), fg=self.coltohex(fcolor))
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:
def __init__(self, x=0, y=0):
self.x = x
@ -79,8 +128,8 @@ class obj:
self.collide = True
self.touch = True
self.anchored = False
self.bcolor = (255, 255, 255)
self.fcolor = (0, 0, 0)
self.bcolor = color3(255, 255, 255)
self.fcolor = color3()
class camera(obj):
def __init__(self):
@ -129,11 +178,19 @@ class game:
if __name__ == "__main__":
testgame = game()
object = obj()
object.char = "#"
testgame.addobj(object)
for i in range(10):
for f in range(10):
object = obj()
object.char = "#"
object.position = vector2(i, f)
object.bcolor = color3()
testgame.addobj(object)
testgame.render()
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()

BIN
icons/object.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

BIN
icons/script.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

27
main.py
View File

@ -14,6 +14,33 @@ lang = lang.read()
LH.setlang(lang)
# 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):
lang = open("clang", 'w')
lang.write(new)