Merge all iter fractal views into one, remove unused imports

This commit is contained in:
csd4ni3l
2025-06-17 13:09:25 +02:00
parent 22c46778d9
commit f1070321fd
7 changed files with 46 additions and 349 deletions

View File

@@ -1,37 +1,42 @@
import arcade, arcade.gui, pyglet, json import arcade, arcade.gui, pyglet, json
from PIL import Image
from game.shader import create_iter_calc_shader from game.shader import create_iter_calc_shader
from utils.constants import menu_background_color, button_style, burning_ship_initial_real_min, burning_ship_initial_real_max, burning_ship_initial_imag_min, burning_ship_initial_imag_max from utils.constants import button_style, initial_real_imag
from utils.preload import button_texture, button_hovered_texture from utils.preload import button_texture, button_hovered_texture
class BurningShipViewer(arcade.gui.UIView): class IterFractalViewer(arcade.gui.UIView):
def __init__(self, pypresence_client): def __init__(self, pypresence_client, fractal_name: str):
super().__init__() super().__init__()
self.pypresence_client = pypresence_client self.pypresence_client = pypresence_client
self.real_min = burning_ship_initial_real_min self.fractal_name = fractal_name
self.real_max = burning_ship_initial_real_max
self.imag_min = burning_ship_initial_imag_min
self.imag_max = burning_ship_initial_imag_max
with open("settings.json", "r") as file: with open("settings.json", "r") as file:
self.settings_dict = json.load(file) self.settings_dict = json.load(file)
self.max_iter = self.settings_dict.get("burning_ship_max_iter", 200) self.escape_radius = int(self.settings_dict.get(f"{self.fractal_name}_escape_radius", 2))
self.real_min, self.real_max, self.imag_min, self.imag_max = initial_real_imag[fractal_name] if fractal_name != "julia" else (-self.escape_radius, self.escape_radius, -self.escape_radius, self.escape_radius)
self.max_iter = self.settings_dict.get(f"{self.fractal_name}_max_iter", 200)
self.zoom = 1.0 self.zoom = 1.0
def on_show_view(self): def on_show_view(self):
super().on_show_view() super().on_show_view()
self.shader_program, self.burning_ship_image = create_iter_calc_shader("burning_ship", self.window.width, self.window.height, self.settings_dict.get("burning_ship_precision", "Single").lower(), 2, int(self.settings_dict.get("burning_ship_escape_radius", 2))) self.shader_program, self.fractal_image = create_iter_calc_shader(
self.fractal_name,
self.window.width,
self.window.height,
self.settings_dict.get(f"{self.fractal_name}_precision", "Single").lower(),
int(self.settings_dict.get(f"{self.fractal_name}_n", 2)), # This will work for non-exponentiable fractals as well because they dont have an _n property
int(self.settings_dict.get(f"{self.fractal_name}_escape_radius", 2)),
self.settings_dict.get("julia_type", "Classic swirling")
)
self.burning_ship_sprite = pyglet.sprite.Sprite(img=self.burning_ship_image) self.fractal_sprite = pyglet.sprite.Sprite(img=self.fractal_image)
self.create_image() self.create_image()
self.pypresence_client.update(state='Viewing Burning Ship', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time) self.pypresence_client.update(state=f'Viewing {self.fractal_name.replace("_", " ").capitalize()}', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
self.setup_ui() self.setup_ui()
@@ -68,15 +73,15 @@ class BurningShipViewer(arcade.gui.UIView):
self.shader_program['u_resolution'] = (self.window.width, self.window.height) self.shader_program['u_resolution'] = (self.window.width, self.window.height)
self.shader_program['u_real_range'] = (self.real_min, self.real_max) self.shader_program['u_real_range'] = (self.real_min, self.real_max)
self.shader_program['u_imag_range'] = (self.imag_min, self.imag_max) self.shader_program['u_imag_range'] = (self.imag_min, self.imag_max)
self.shader_program.dispatch(self.burning_ship_image.width, self.burning_ship_image.height, 1, barrier=pyglet.gl.GL_ALL_BARRIER_BITS) self.shader_program.dispatch(self.fractal_image.width, self.fractal_image.height, 1, barrier=pyglet.gl.GL_ALL_BARRIER_BITS)
def on_mouse_press(self, x: int, y: int, button: int, modifiers: int) -> bool | None: def on_mouse_press(self, x: int, y: int, button: int, modifiers: int) -> bool | None:
super().on_mouse_press(x, y, button, modifiers) super().on_mouse_press(x, y, button, modifiers)
if button == arcade.MOUSE_BUTTON_LEFT: if button == arcade.MOUSE_BUTTON_LEFT:
zoom = self.settings_dict.get("burning_ship_zoom_increase", 2) zoom = self.settings_dict.get(f"{self.fractal_name}_zoom_increase", 2)
elif button == arcade.MOUSE_BUTTON_RIGHT: elif button == arcade.MOUSE_BUTTON_RIGHT:
zoom = 1 / self.settings_dict.get("burning_ship_zoom_increase", 2) zoom = 1 / self.settings_dict.get(f"{self.fractal_name}_zoom_increase", 2)
else: else:
return return
@@ -87,9 +92,9 @@ class BurningShipViewer(arcade.gui.UIView):
self.zoom_at(self.window.mouse.data["x"], self.window.mouse.data["y"], zoom) self.zoom_at(self.window.mouse.data["x"], self.window.mouse.data["y"], zoom)
self.create_image() self.create_image()
self.pypresence_client.update(state='Viewing Burning Ship', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time) self.pypresence_client.update(state=f'Viewing {self.fractal_name.replace("_", " ").capitalize()}', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
def on_draw(self): def on_draw(self):
self.window.clear() self.window.clear()
self.burning_ship_sprite.draw() self.fractal_sprite.draw()
self.ui.draw() self.ui.draw()

View File

@@ -1,95 +0,0 @@
import arcade, arcade.gui, pyglet, json
from PIL import Image
from game.shader import create_iter_calc_shader
from utils.constants import menu_background_color, button_style
from utils.preload import button_texture, button_hovered_texture
class JuliaViewer(arcade.gui.UIView):
def __init__(self, pypresence_client):
super().__init__()
self.pypresence_client = pypresence_client
with open("settings.json", "r") as file:
self.settings_dict = json.load(file)
self.max_iter = self.settings_dict.get("julia_max_iter", 200)
self.zoom = 1.0
self.real_min = -self.settings_dict.get("julia_escape_radius", 2)
self.real_max = self.settings_dict.get("julia_escape_radius", 2)
self.imag_min = -self.settings_dict.get("julia_escape_radius", 2)
self.imag_max = self.settings_dict.get("julia_escape_radius", 2)
def zoom_at(self, center_x, center_y, zoom_factor):
center_real = self.real_min + (center_x / self.width) * (self.real_max - self.real_min)
center_imag = self.imag_min + (center_y / self.height) * (self.imag_max - self.imag_min)
new_real_range = (self.real_max - self.real_min) / zoom_factor
new_imag_range = (self.imag_max - self.imag_min) / zoom_factor
self.real_min = center_real - new_real_range / 2
self.real_max = center_real + new_real_range / 2
self.imag_min = center_imag - new_imag_range / 2
self.imag_max = center_imag + new_imag_range / 2
def on_show_view(self):
super().on_show_view()
self.shader_program, self.julia_image = create_iter_calc_shader("julia", self.window.width, self.window.height, self.settings_dict.get("julia_precision", "Single").lower(), int(self.settings_dict.get("julia_n", 2)), self.settings_dict.get("julia_escape_radius", 2), self.settings_dict.get("julia_type", "Classic swirling"))
self.julia_sprite = pyglet.sprite.Sprite(img=self.julia_image)
self.create_image()
self.pypresence_client.update(state='Viewing Julia', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
self.setup_ui()
def main_exit(self):
from menus.main import Main
self.window.show_view(Main(self.pypresence_client))
def setup_ui(self):
self.anchor = self.add_widget(arcade.gui.UIAnchorLayout(size_hint=(1, 1)))
self.info_box = self.anchor.add(arcade.gui.UIBoxLayout(space_between=10, vertical=False), anchor_x="center", anchor_y="top")
self.zoom_label = self.info_box.add(arcade.gui.UILabel(text=f"Zoom: {self.zoom}", font_name="Protest Strike", font_size=16))
self.max_iter_label = self.info_box.add(arcade.gui.UILabel(text=f"Max Iterations: {self.max_iter}", font_name="Protest Strike", font_size=16))
self.back_button = arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='<--', style=button_style, width=100, height=50)
self.back_button.on_click = lambda event: self.main_exit()
self.anchor.add(self.back_button, anchor_x="left", anchor_y="top", align_x=5, align_y=-5)
def create_image(self):
with self.shader_program:
self.shader_program['u_maxIter'] = int(self.max_iter)
self.shader_program['u_resolution'] = (self.window.width, self.window.height)
self.shader_program['u_real_range'] = (self.real_min, self.real_max)
self.shader_program['u_imag_range'] = (self.imag_min, self.imag_max)
self.shader_program.dispatch(self.julia_image.width, self.julia_image.height, 1, barrier=pyglet.gl.GL_ALL_BARRIER_BITS)
def on_mouse_press(self, x: int, y: int, button: int, modifiers: int) -> bool | None:
super().on_mouse_press(x, y, button, modifiers)
if button == arcade.MOUSE_BUTTON_LEFT:
zoom = self.settings_dict.get("julia_zoom_increase", 2)
elif button == arcade.MOUSE_BUTTON_RIGHT:
zoom = 1 / self.settings_dict.get("julia_zoom_increase", 2)
else:
return
self.zoom *= zoom
self.zoom_label.text = f"Zoom: {self.zoom}"
self.zoom_at(self.window.mouse.data["x"], self.window.mouse.data["y"], zoom)
self.create_image()
self.pypresence_client.update(state='Viewing Julia', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
def on_draw(self):
self.window.clear()
self.julia_sprite.draw()
self.ui.draw()

View File

@@ -1,95 +0,0 @@
import arcade, arcade.gui, pyglet, json
from PIL import Image
from game.shader import create_iter_calc_shader
from utils.constants import menu_background_color, button_style, mandelbrot_initial_real_min, mandelbrot_initial_real_max, mandelbrot_initial_imag_min, mandelbrot_initial_imag_max
from utils.preload import button_texture, button_hovered_texture
class MandelbrotViewer(arcade.gui.UIView):
def __init__(self, pypresence_client):
super().__init__()
self.pypresence_client = pypresence_client
self.real_min = mandelbrot_initial_real_min
self.real_max = mandelbrot_initial_real_max
self.imag_min = mandelbrot_initial_imag_min
self.imag_max = mandelbrot_initial_imag_max
with open("settings.json", "r") as file:
self.settings_dict = json.load(file)
self.max_iter = self.settings_dict.get("mandelbrot_max_iter", 200)
self.zoom = 1.0
def on_show_view(self):
super().on_show_view()
self.shader_program, self.mandelbrot_image = create_iter_calc_shader("mandelbrot", self.window.width, self.window.height, self.settings_dict.get("mandelbrot_precision", "Single").lower(), int(self.settings_dict.get("mandelbrot_n", 2)), int(self.settings_dict.get("mandelbrot_escape_radius", 2)))
self.mandelbrot_sprite = pyglet.sprite.Sprite(img=self.mandelbrot_image)
self.create_image()
self.pypresence_client.update(state='Viewing Mandelbrot', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
self.setup_ui()
def main_exit(self):
from menus.main import Main
self.window.show_view(Main(self.pypresence_client))
def setup_ui(self):
self.anchor = self.add_widget(arcade.gui.UIAnchorLayout(size_hint=(1, 1)))
self.info_box = self.anchor.add(arcade.gui.UIBoxLayout(space_between=10, vertical=False), anchor_x="center", anchor_y="top")
self.zoom_label = self.info_box.add(arcade.gui.UILabel(text=f"Zoom: {self.zoom}", font_name="Protest Strike", font_size=16))
self.max_iter_label = self.info_box.add(arcade.gui.UILabel(text=f"Max Iterations: {self.max_iter}", font_name="Protest Strike", font_size=16))
self.back_button = arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='<--', style=button_style, width=100, height=50)
self.back_button.on_click = lambda event: self.main_exit()
self.anchor.add(self.back_button, anchor_x="left", anchor_y="top", align_x=5, align_y=-5)
def zoom_at(self, center_x, center_y, zoom_factor):
center_real = self.real_min + (center_x / self.width) * (self.real_max - self.real_min)
center_imag = self.imag_min + (center_y / self.height) * (self.imag_max - self.imag_min)
new_real_range = (self.real_max - self.real_min) / zoom_factor
new_imag_range = (self.imag_max - self.imag_min) / zoom_factor
self.real_min = center_real - new_real_range / 2
self.real_max = center_real + new_real_range / 2
self.imag_min = center_imag - new_imag_range / 2
self.imag_max = center_imag + new_imag_range / 2
def create_image(self):
with self.shader_program:
self.shader_program['u_maxIter'] = int(self.max_iter)
self.shader_program['u_resolution'] = (self.window.width, self.window.height)
self.shader_program['u_real_range'] = (self.real_min, self.real_max)
self.shader_program['u_imag_range'] = (self.imag_min, self.imag_max)
self.shader_program.dispatch(self.mandelbrot_image.width, self.mandelbrot_image.height, 1, barrier=pyglet.gl.GL_ALL_BARRIER_BITS)
def on_mouse_press(self, x: int, y: int, button: int, modifiers: int) -> bool | None:
super().on_mouse_press(x, y, button, modifiers)
if button == arcade.MOUSE_BUTTON_LEFT:
zoom = self.settings_dict.get("mandelbrot_zoom_increase", 2)
elif button == arcade.MOUSE_BUTTON_RIGHT:
zoom = 1 / self.settings_dict.get("mandelbrot_zoom_increase", 2)
else:
return
self.zoom *= zoom
self.zoom_label.text = f"Zoom: {self.zoom}"
self.zoom_at(self.window.mouse.data["x"], self.window.mouse.data["y"], zoom)
self.create_image()
self.pypresence_client.update(state='Viewing Mandelbrot', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
def on_draw(self):
self.window.clear()
self.mandelbrot_sprite.draw()
self.ui.draw()

View File

@@ -1,95 +0,0 @@
import arcade, arcade.gui, pyglet, json
from PIL import Image
from game.shader import create_iter_calc_shader
from utils.constants import menu_background_color, button_style, newton_fractal_initial_real_min, newton_fractal_initial_real_max, newton_fractal_initial_imag_min, newton_fractal_initial_imag_max
from utils.preload import button_texture, button_hovered_texture
class NewtonFractalViewer(arcade.gui.UIView):
def __init__(self, pypresence_client):
super().__init__()
self.pypresence_client = pypresence_client
self.real_min = newton_fractal_initial_real_min
self.real_max = newton_fractal_initial_real_max
self.imag_min = newton_fractal_initial_imag_min
self.imag_max = newton_fractal_initial_imag_max
with open("settings.json", "r") as file:
self.settings_dict = json.load(file)
self.max_iter = self.settings_dict.get("newton_fractal_max_iter", 200)
self.zoom = 1.0
def on_show_view(self):
super().on_show_view()
self.shader_program, self.newton_fractal_image = create_iter_calc_shader("newton_fractal", self.window.width, self.window.height, self.settings_dict.get("newton_fractal_precision", "Single").lower(), 2, int(self.settings_dict.get("newton_fractal_escape_radius", 2)))
self.newton_fractal_sprite = pyglet.sprite.Sprite(img=self.newton_fractal_image)
self.create_image()
self.pypresence_client.update(state='Viewing Newton Fractal', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
self.setup_ui()
def main_exit(self):
from menus.main import Main
self.window.show_view(Main(self.pypresence_client))
def setup_ui(self):
self.anchor = self.add_widget(arcade.gui.UIAnchorLayout(size_hint=(1, 1)))
self.info_box = self.anchor.add(arcade.gui.UIBoxLayout(space_between=10, vertical=False), anchor_x="center", anchor_y="top")
self.zoom_label = self.info_box.add(arcade.gui.UILabel(text=f"Zoom: {self.zoom}", font_name="Protest Strike", font_size=16))
self.max_iter_label = self.info_box.add(arcade.gui.UILabel(text=f"Max Iterations: {self.max_iter}", font_name="Protest Strike", font_size=16))
self.back_button = arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='<--', style=button_style, width=100, height=50)
self.back_button.on_click = lambda event: self.main_exit()
self.anchor.add(self.back_button, anchor_x="left", anchor_y="top", align_x=5, align_y=-5)
def zoom_at(self, center_x, center_y, zoom_factor):
center_real = self.real_min + (center_x / self.width) * (self.real_max - self.real_min)
center_imag = self.imag_min + (center_y / self.height) * (self.imag_max - self.imag_min)
new_real_range = (self.real_max - self.real_min) / zoom_factor
new_imag_range = (self.imag_max - self.imag_min) / zoom_factor
self.real_min = center_real - new_real_range / 2
self.real_max = center_real + new_real_range / 2
self.imag_min = center_imag - new_imag_range / 2
self.imag_max = center_imag + new_imag_range / 2
def create_image(self):
with self.shader_program:
self.shader_program['u_maxIter'] = int(self.max_iter)
self.shader_program['u_resolution'] = (self.window.width, self.window.height)
self.shader_program['u_real_range'] = (self.real_min, self.real_max)
self.shader_program['u_imag_range'] = (self.imag_min, self.imag_max)
self.shader_program.dispatch(self.newton_fractal_image.width, self.newton_fractal_image.height, 1, barrier=pyglet.gl.GL_ALL_BARRIER_BITS)
def on_mouse_press(self, x: int, y: int, button: int, modifiers: int) -> bool | None:
super().on_mouse_press(x, y, button, modifiers)
if button == arcade.MOUSE_BUTTON_LEFT:
zoom = self.settings_dict.get("newton_fractal_zoom_increase", 2)
elif button == arcade.MOUSE_BUTTON_RIGHT:
zoom = 1 / self.settings_dict.get("newton_fractal_zoom_increase", 2)
else:
return
self.zoom *= zoom
self.zoom_label.text = f"Zoom: {self.zoom}"
self.zoom_at(self.window.mouse.data["x"], self.window.mouse.data["y"], zoom)
self.create_image()
self.pypresence_client.update(state='Viewing Newton Fractal', details=f'Zoom: {self.zoom}\nMax Iterations: {self.max_iter}', start=self.pypresence_client.start_time)
def on_draw(self):
self.window.clear()
self.newton_fractal_sprite.draw()
self.ui.draw()

View File

@@ -1,9 +1,7 @@
import arcade, arcade.gui, pyglet, json import arcade, arcade.gui, pyglet, json
from PIL import Image
from game.shader import create_sierpinsky_carpet_shader from game.shader import create_sierpinsky_carpet_shader
from utils.constants import menu_background_color, button_style from utils.constants import button_style
from utils.preload import button_texture, button_hovered_texture from utils.preload import button_texture, button_hovered_texture
class SierpinskyCarpetViewer(arcade.gui.UIView): class SierpinskyCarpetViewer(arcade.gui.UIView):

View File

@@ -1,6 +1,6 @@
import arcade, arcade.gui import arcade, arcade.gui
from utils.constants import button_style from utils.constants import button_style, iter_fractals
from utils.preload import button_texture, button_hovered_texture from utils.preload import button_texture, button_hovered_texture
class FractalChooser(arcade.gui.UIView): class FractalChooser(arcade.gui.UIView):
@@ -8,6 +8,7 @@ class FractalChooser(arcade.gui.UIView):
super().__init__() super().__init__()
self.pypresence_client = pypresence_client self.pypresence_client = pypresence_client
self.iter_fractal_buttons = []
def on_show_view(self): def on_show_view(self):
super().on_show_view() super().on_show_view()
@@ -23,41 +24,26 @@ class FractalChooser(arcade.gui.UIView):
self.back_button.on_click = lambda event: self.main_exit() self.back_button.on_click = lambda event: self.main_exit()
self.anchor.add(self.back_button, anchor_x="left", anchor_y="top", align_x=5, align_y=-5) self.anchor.add(self.back_button, anchor_x="left", anchor_y="top", align_x=5, align_y=-5)
self.mandelbrot_button = self.grid.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='Mandelbrot', style=button_style, width=200, height=200), row=0, column=0) for n, fractal_name in enumerate(iter_fractals):
self.mandelbrot_button.on_click = lambda event: self.mandelbrot() row = n // 3
col = n % 3
self.sierpinsky_carpet_button = self.grid.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='Sierpinsky Carpet', style=button_style, width=200, height=200), row=0, column=1) self.iter_fractal_buttons.append(self.grid.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text=fractal_name.replace("_", " ").capitalize(), style=button_style, width=200, height=200), row=row, column=col))
self.mandelbrot_button.on_click = lambda event, fractal_name=fractal_name: self.iter_fractal(fractal_name)
row = n // 3
col = n % 3
self.sierpinsky_carpet_button = self.grid.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='Sierpinsky Carpet', style=button_style, width=200, height=200), row=0, column=n + 1)
self.sierpinsky_carpet_button.on_click = lambda event: self.sierpinsky_carpet() self.sierpinsky_carpet_button.on_click = lambda event: self.sierpinsky_carpet()
self.julia_button = self.grid.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='Julia', style=button_style, width=200, height=200), row=0, column=2)
self.julia_button.on_click = lambda event: self.julia()
self.burning_ship_button = self.grid.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='Burning Ship', style=button_style, width=200, height=200), row=1, column=0)
self.burning_ship_button.on_click = lambda event: self.burning_ship()
self.newton_fractal_button = self.grid.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='Newton Fractal', style=button_style, width=200, height=200), row=1, column=1)
self.newton_fractal_button.on_click = lambda event: self.newton_fractal()
def main_exit(self): def main_exit(self):
from menus.main import Main from menus.main import Main
self.window.show_view(Main(self.pypresence_client)) self.window.show_view(Main(self.pypresence_client))
def mandelbrot(self): def iter_fractal(self, fractal_name):
from game.mandelbrot import MandelbrotViewer from game.iter_fractal_viewer import IterFractalViewer
self.window.show_view(MandelbrotViewer(self.pypresence_client)) self.window.show_view(IterFractalViewer(self.pypresence_client, fractal_name))
def sierpinsky_carpet(self): def sierpinsky_carpet(self):
from game.sierpinsky_carpet import SierpinskyCarpetViewer from game.sierpinsky_carpet import SierpinskyCarpetViewer
self.window.show_view(SierpinskyCarpetViewer(self.pypresence_client)) self.window.show_view(SierpinskyCarpetViewer(self.pypresence_client))
def julia(self):
from game.julia import JuliaViewer
self.window.show_view(JuliaViewer(self.pypresence_client))
def burning_ship(self):
from game.burning_ship import BurningShipViewer
self.window.show_view(BurningShipViewer(self.pypresence_client))
def newton_fractal(self):
from game.newton_fractal import NewtonFractalViewer
self.window.show_view(NewtonFractalViewer(self.pypresence_client))

View File

@@ -7,20 +7,11 @@ menu_background_color = (30, 30, 47)
log_dir = 'logs' log_dir = 'logs'
discord_presence_id = 1365949409254441000 discord_presence_id = 1365949409254441000
mandelbrot_initial_real_min = -2.0 initial_real_imag = {
mandelbrot_initial_real_max = 1.0 "mandelbrot": (-2.0, 1.0, -1.0, 1.0),
mandelbrot_initial_imag_min = -1.0 "burning_ship": (-2.0, 1.5, -2.0, 1.0),
mandelbrot_initial_imag_max = 1.0 "newton_fractal": (-2.0, 2.0, -2.0, 2.0)
}
burning_ship_initial_real_min = -2.0
burning_ship_initial_real_max = 1.5
burning_ship_initial_imag_min = -2.0
burning_ship_initial_imag_max = 1.0
newton_fractal_initial_real_min = -2.0
newton_fractal_initial_real_max = 2.0
newton_fractal_initial_imag_min = -2.0
newton_fractal_initial_imag_max = 2.0
c_for_julia_type = { c_for_julia_type = {
"Classic swirling": (-0.7, 0.27015), "Classic swirling": (-0.7, 0.27015),
@@ -29,6 +20,8 @@ c_for_julia_type = {
"Snowflake": (-0.8, 0.156) "Snowflake": (-0.8, 0.156)
} }
iter_fractals = ["mandelbrot", "julia", "burning_ship", "newton_fractal"]
button_style = {'normal': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK), 'hover': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK), button_style = {'normal': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK), 'hover': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK),
'press': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK), 'disabled': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK)} 'press': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK), 'disabled': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK)}
big_button_style = {'normal': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK, font_size=26), 'hover': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK, font_size=26), big_button_style = {'normal': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK, font_size=26), 'hover': UITextureButtonStyle(font_name="Protest Strike", font_color=arcade.color.BLACK, font_size=26),