mirror of
https://github.com/csd4ni3l/logical-signals.git
synced 2026-01-01 04:23:46 +01:00
I forgot to commit, but i have added all the basics: nodes, and connections, and evaluation. Took a long time due to bugs
This commit is contained in:
@@ -7,6 +7,17 @@ menu_background_color = (30, 30, 47)
|
||||
log_dir = 'logs'
|
||||
discord_presence_id = 1427213145667276840
|
||||
|
||||
LOGICAL_GATES = {
|
||||
"INPUT": lambda a: a,
|
||||
"AND": lambda a, b: a and b,
|
||||
"OR": lambda a, b: a or b,
|
||||
"NAND": lambda a, b: not (a and b),
|
||||
"NOR": lambda a, b: not (a or b),
|
||||
"XOR": lambda a, b: a != b,
|
||||
"XNOR": lambda a, b: a == b,
|
||||
"OUTPUT": lambda a: a
|
||||
}
|
||||
|
||||
button_style = {'normal': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK), 'hover': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK),
|
||||
'press': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK), 'disabled': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK)}
|
||||
big_button_style = {'normal': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, font_size=26), 'hover': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, font_size=26),
|
||||
|
||||
@@ -2,7 +2,28 @@ import logging, arcade, arcade.gui, sys, traceback
|
||||
|
||||
from utils.constants import menu_background_color
|
||||
|
||||
import pyglet.info, pyglet.event
|
||||
import pyglet.display
|
||||
|
||||
def lerp(a, b, t):
|
||||
return a + (b - a) * t
|
||||
|
||||
def cubic_bezier_point(p0, p1, p2, p3, t):
|
||||
u = 1 - t
|
||||
x = (u ** 3) * p0[0] + 3 * (u ** 2) * t * p1[0] + 3 * u * (t ** 2) * p2[0] + (t ** 3) * p3[0]
|
||||
y = (u ** 3) * p0[1] + 3 * (u ** 2) * t * p1[1] + 3 * u * (t ** 2) * p2[1] + (t ** 3) * p3[1]
|
||||
return x, y
|
||||
|
||||
def cubic_bezier_points(p0, p1, p2, p3, segments=40):
|
||||
return [cubic_bezier_point(p0, p1, p2, p3, i / segments) for i in range(segments + 1)]
|
||||
|
||||
def get_gate_port_position(gate, port: str):
|
||||
rect = gate.rect
|
||||
center_y = rect.center_y
|
||||
|
||||
if port == "output":
|
||||
return (rect.right, center_y)
|
||||
else:
|
||||
return (rect.left, center_y)
|
||||
|
||||
def dump_platform():
|
||||
import platform
|
||||
|
||||
Reference in New Issue
Block a user