✨
This commit is contained in:
136
data.json
136
data.json
@@ -1,31 +1,123 @@
|
|||||||
{
|
{
|
||||||
"words": [
|
"words": [
|
||||||
["Ansem",0],
|
["Adrian",0],
|
||||||
["Mickey",0],
|
["Andromedes",0],
|
||||||
["Mouse",0],
|
["Argyn",0],
|
||||||
["Terra",0],
|
["Aslak",0],
|
||||||
["Terranort",0],
|
["Butterswick",0],
|
||||||
["Xehanort",0],
|
["Celiestra",0],
|
||||||
["Xemnas",0],
|
["Darkwood",0],
|
||||||
|
["Edgar",0],
|
||||||
|
["Eggert",0],
|
||||||
|
["Enkelton",0],
|
||||||
|
["Galinndan",0],
|
||||||
|
["Goldenleaf",0],
|
||||||
|
["Gyro",0],
|
||||||
|
["Half-ear",0],
|
||||||
|
["Marigold",0],
|
||||||
|
["McGalloway",0],
|
||||||
|
["Moklus",0],
|
||||||
|
["Nix",0],
|
||||||
|
["Paterius",0],
|
||||||
|
["Sagemonger",0],
|
||||||
|
["Sam",0],
|
||||||
|
["Silvan",0],
|
||||||
|
["Silvertongue",0],
|
||||||
|
["Tymna",0],
|
||||||
|
["Valindis",0],
|
||||||
|
["Virtus",0],
|
||||||
|
["Volynthia",0],
|
||||||
|
|
||||||
["apprentice",1],
|
["bandit", 1],
|
||||||
["darkness",1],
|
["changeling", 1],
|
||||||
["door",1],
|
["child", 1],
|
||||||
["heart",1],
|
["diplomat", 1],
|
||||||
["nobody",1],
|
["dragon", 1],
|
||||||
["seeker",1],
|
["dwarf", 1],
|
||||||
["shirt",1],
|
["elf", 1],
|
||||||
|
["giant", 1],
|
||||||
|
["human", 1],
|
||||||
|
["inn", 1],
|
||||||
|
["orc", 1],
|
||||||
|
["pegasus", 1],
|
||||||
|
["power", 1],
|
||||||
|
["rose", 1],
|
||||||
|
["satyr", 1],
|
||||||
|
["sewers", 1],
|
||||||
|
["soup", 1],
|
||||||
|
["tower", 1],
|
||||||
|
["trainee", 1],
|
||||||
|
["war", 1],
|
||||||
|
|
||||||
["killed",3],
|
["black",2],
|
||||||
["possessed",3],
|
["blue",2],
|
||||||
["ripped",3],
|
["green",2],
|
||||||
|
["purple",2],
|
||||||
|
["red",2],
|
||||||
|
|
||||||
["less",4],
|
["ambush",3],
|
||||||
["off",4],
|
["deserted",3],
|
||||||
["wise",4]
|
["eating",3],
|
||||||
|
["escape",3],
|
||||||
|
["gathering",3],
|
||||||
|
["kidnapped",3],
|
||||||
|
["save",3],
|
||||||
|
["terrorizing",3],
|
||||||
|
|
||||||
|
["adopted",4],
|
||||||
|
["half",4],
|
||||||
|
["high",4],
|
||||||
|
["flying",4],
|
||||||
|
|
||||||
|
["Dragonsong",5],
|
||||||
|
["Giant's Heart",5],
|
||||||
|
["Hammerhome",5],
|
||||||
|
["The Empire",5],
|
||||||
|
["The Feywilds",5],
|
||||||
|
["The Westerlands",5],
|
||||||
|
["Volantis",5],
|
||||||
|
|
||||||
|
["Lady", 6],
|
||||||
|
["Lord", 6],
|
||||||
|
|
||||||
|
["artificer",7],
|
||||||
|
["barbarian",7],
|
||||||
|
["bard",7],
|
||||||
|
["cleric",7],
|
||||||
|
["druid",7],
|
||||||
|
["fighter",7],
|
||||||
|
["monk",7],
|
||||||
|
["paladin",7],
|
||||||
|
["ranger",7],
|
||||||
|
["rogue",7],
|
||||||
|
["sorcerer",7],
|
||||||
|
["warlock",7],
|
||||||
|
["wizard",7]
|
||||||
],
|
],
|
||||||
"pages": [
|
"pages": [
|
||||||
"[Xehanort/0] [possessed/3] [Terra/0], which created [Terra/0]-[Xehanort/0], also known as [Terranort/0]. He became an [apprentice/1] to [Ansem/0] the [wise/4], and eventually split into the [nobody/1] [Xemnas/0] and the [heart/1][less/4] [Ansem/0], [seeker/1] of [darkness/1].",
|
[
|
||||||
"[Mickey/0] [Mouse/0] was [shirt/1][less/4] at the end of Kingdom Hearts because his [shirt/1] had been [ripped/3] [off/4] by [heart/1][less/4] behind the [door/1] to [darkness/1]."
|
"The Party (Before Session)",
|
||||||
|
"- [Adrian/0] [Goldenleaf/0], a [high/4] [elf/1] [rogue/7] from [Volantis/5] and owner of the [Goldenleaf/0] [inn/1].",
|
||||||
|
"- [Andromedes/0] [Moklus/0], a [dwarf/1] [artificer/7] from [Hammerhome/5] and [diplomat/1] in [Dragonsong/5].",
|
||||||
|
"- [Aslak/0] ???, an [orc/1] [barbarian/7]/[monk/7] from The [The%Westerlands/5] and [adopted/4] [child/1] of [Nix/0] [McGalloway/0].",
|
||||||
|
"- [Marigold/0] [Sagemonger/0], a [high/4] [elf/1] [wizard/7] from The [The%Empire/5] and owner of [Sagemonger/0]'s.",
|
||||||
|
"- [Nix/0] [McGalloway/0], a [changeling/1] [monk/7] from The [The%Westerlands/5] and owner of the [flying/4] [pegasus/1].",
|
||||||
|
"- [Sam/0], a [satyr/1] [cleric/7] from The [The%Feywilds/5].",
|
||||||
|
"- [Silvan/0] ???, a [human/1] [fighter/7] from The [The%Empire/5] and formely a [trainee/1] of [Paterius/0] [Enkelton/0]."
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Present Threats",
|
||||||
|
"- [Lord/6] [Edgar/0] [Darkwood/0] is [gathering/3] [power/1] in his [tower/1], far away from civilization.",
|
||||||
|
"- [Volynthia/0], a [green/2] [dragon/1], is trying to [escape/3] from The [The%Feywilds/5], helped by a group of [orc/1]s.",
|
||||||
|
"- A [war/1] is raging between [Lady/6] [Argyn/0] and the [giant/1]s, for control of [Giant's%Heart/5]."
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Before the Session",
|
||||||
|
"The [purple/2] [rose/1], also known as the [soup/1] [bandit/1]s, have been [terrorizing/3] the citizens of [Dragonsong/5] by [eating/3] all of their [soup/1]. They also [kidnapped/3] [Galinndan/0], friend of [Adrian/0] [Goldenleaf/0] and chef of the [Goldenleaf/0] [inn/1]. They are lead by [Valindis/0] [Half-ear/0] and are headquartered in the [Dragonsong/5] [sewers/1]."
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"Into the Dark",
|
||||||
|
"The party head into the [Dragonsong/5] [sewers/1] to [ambush/3] the [purple/2] [rose/1] and [save/3] [Galinndan/0]. They meet and join up with ???, a [human/1] [rogue/7], who has [deserted/3] the [purple/2] [rose/1]."
|
||||||
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
31
data_test.json
Normal file
31
data_test.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"words": [
|
||||||
|
["Ansem",0],
|
||||||
|
["Mickey",0],
|
||||||
|
["Mouse",0],
|
||||||
|
["Terra",0],
|
||||||
|
["Terranort",0],
|
||||||
|
["Xehanort",0],
|
||||||
|
["Xemnas",0],
|
||||||
|
|
||||||
|
["apprentice",1],
|
||||||
|
["darkness",1],
|
||||||
|
["door",1],
|
||||||
|
["heart",1],
|
||||||
|
["nobody",1],
|
||||||
|
["seeker",1],
|
||||||
|
["shirt",1],
|
||||||
|
|
||||||
|
["killed",3],
|
||||||
|
["possessed",3],
|
||||||
|
["ripped",3],
|
||||||
|
|
||||||
|
["less",4],
|
||||||
|
["off",4],
|
||||||
|
["wise",4]
|
||||||
|
],
|
||||||
|
"pages": [
|
||||||
|
"[Xehanort/0] [possessed/3] [Terra/0], which created [Terra/0]-[Xehanort/0], also known as [Terranort/0]. He became an [apprentice/1] to [Ansem/0] the [wise/4], and eventually split into the [nobody/1] [Xemnas/0] and the [heart/1][less/4] [Ansem/0], [seeker/1] of [darkness/1].",
|
||||||
|
"[Mickey/0] [Mouse/0] was [shirt/1][less/4] at the end of Kingdom Hearts because his [shirt/1] had been [ripped/3] [off/4] by [heart/1][less/4] behind the [door/1] to [darkness/1]."
|
||||||
|
]
|
||||||
|
}
|
||||||
150
main.py
150
main.py
@@ -17,47 +17,48 @@ WORD_BORDER_COLOR = "#fffcf2"
|
|||||||
WORD_SHADOW_COLOR = "#000000"
|
WORD_SHADOW_COLOR = "#000000"
|
||||||
|
|
||||||
# Drawing constants
|
# Drawing constants
|
||||||
SCREEN_WIDTH = 2560
|
SCREEN_WIDTH = 5120
|
||||||
SCREEN_HEIGHT = 1440
|
SCREEN_HEIGHT = 2880
|
||||||
PAGE_MARGIN = 20
|
|
||||||
|
|
||||||
PAGE_BORDER_RADIUS = 40
|
PAGE_MARGIN = 30
|
||||||
|
PAGE_BORDER_RADIUS = 80
|
||||||
PAGE_BORDER_WIDTH = 20
|
PAGE_BORDER_WIDTH = 20
|
||||||
|
|
||||||
|
WORD_WIDTH = 432
|
||||||
|
WORD_HEIGHT = 90
|
||||||
|
WORD_MARGIN = 20
|
||||||
|
WORD_BORDER_RADIUS = 60
|
||||||
|
WORD_BORDER_WIDTH = 8
|
||||||
|
WORD_FONT_SIZE = 44
|
||||||
|
WORD_SHADOW_SIZE = 8
|
||||||
|
|
||||||
WORD_WIDTH = 228
|
GRID_WIDTH = 6
|
||||||
WORD_HEIGHT = 55
|
GRID_HEIGHT = 25
|
||||||
WORD_MARGIN = 16
|
|
||||||
WORD_BORDER_RADIUS = 30
|
|
||||||
WORD_BORDER_WIDTH = 6
|
|
||||||
WORD_FONT_SIZE = 30
|
|
||||||
WORD_SHADOW_SIZE = 5
|
|
||||||
|
|
||||||
GRID_WIDTH = 5
|
|
||||||
GRID_HEIGHT = 18
|
|
||||||
|
|
||||||
WORD_PAGE_WIDTH = PAGE_BORDER_WIDTH*2+(WORD_WIDTH+WORD_MARGIN)*GRID_WIDTH+WORD_MARGIN
|
WORD_PAGE_WIDTH = PAGE_BORDER_WIDTH*2+(WORD_WIDTH+WORD_MARGIN)*GRID_WIDTH+WORD_MARGIN
|
||||||
WORD_PAGE_HEIGHT = SCREEN_HEIGHT-PAGE_MARGIN*2
|
WORD_PAGE_HEIGHT = SCREEN_HEIGHT-PAGE_MARGIN*2
|
||||||
|
|
||||||
TAB_WIDTH = 80
|
TAB_WIDTH = 120
|
||||||
TAB_HEIGHT = 80
|
TAB_HEIGHT = 160
|
||||||
|
TAB_MARGIN = 30
|
||||||
TAB_POS = Vector2(WORD_PAGE_WIDTH+PAGE_MARGIN*2,PAGE_MARGIN)
|
TAB_POS = Vector2(WORD_PAGE_WIDTH+PAGE_MARGIN*2,PAGE_MARGIN)
|
||||||
|
|
||||||
TEXT_PAGE_POS = Vector2(WORD_PAGE_WIDTH+PAGE_MARGIN*2,TAB_HEIGHT+PAGE_MARGIN*2)
|
TEXT_PAGE_POS = Vector2(WORD_PAGE_WIDTH+PAGE_MARGIN*2,TAB_HEIGHT+PAGE_MARGIN*2)
|
||||||
TEXT_PAGE_WIDTH = SCREEN_WIDTH-(WORD_PAGE_WIDTH+PAGE_MARGIN*3)
|
TEXT_PAGE_WIDTH = SCREEN_WIDTH-(WORD_PAGE_WIDTH+PAGE_MARGIN*3)
|
||||||
TEXT_PAGE_HEIGHT = SCREEN_HEIGHT-(TAB_HEIGHT+PAGE_MARGIN*3)
|
TEXT_PAGE_HEIGHT = SCREEN_HEIGHT-(TAB_HEIGHT+PAGE_MARGIN*3)
|
||||||
|
|
||||||
TEXT_MARGIN = 20
|
TEXT_MARGIN = 40
|
||||||
TEXT_TOP_MARGIN = 35
|
TEXT_TOP_MARGIN = 68
|
||||||
TEXT_WIDTH = TEXT_PAGE_WIDTH - TEXT_MARGIN*2
|
TEXT_WIDTH = TEXT_PAGE_WIDTH - PAGE_BORDER_WIDTH*2 - TEXT_MARGIN*2
|
||||||
TEXT_HEIGHT = TEXT_PAGE_HEIGHT - TEXT_MARGIN*2
|
TEXT_HEIGHT = TEXT_PAGE_HEIGHT - PAGE_BORDER_WIDTH*2 - TEXT_MARGIN*2
|
||||||
|
|
||||||
WORD_SLOT_SPACING = " "*12
|
WORD_SLOT_SPACING = " "*16
|
||||||
WORD_SLOT_NUDGING = 22
|
WORD_SLOT_NUDGING = 25
|
||||||
|
WORD_SLOT_NUDGE_DOWN = -5
|
||||||
|
|
||||||
INDICATOR_SIZE = 40
|
INDICATOR_SIZE = 80
|
||||||
INDICATOR_BORDER = 10
|
INDICATOR_BORDER = 20
|
||||||
INDICATOR_MARGIN = 30
|
INDICATOR_MARGIN = 60
|
||||||
INDICATOR_POS = Vector2(TEXT_PAGE_WIDTH-(INDICATOR_SIZE+INDICATOR_MARGIN),TEXT_PAGE_HEIGHT-(INDICATOR_SIZE+INDICATOR_MARGIN))
|
INDICATOR_POS = Vector2(TEXT_PAGE_WIDTH-(INDICATOR_SIZE+INDICATOR_MARGIN),TEXT_PAGE_HEIGHT-(INDICATOR_SIZE+INDICATOR_MARGIN))
|
||||||
|
|
||||||
class WordColor(Enum):
|
class WordColor(Enum):
|
||||||
@@ -67,17 +68,19 @@ class WordColor(Enum):
|
|||||||
Blue = 3 # Verbs
|
Blue = 3 # Verbs
|
||||||
Grey = 4 # Other
|
Grey = 4 # Other
|
||||||
Purple = 5 # Places
|
Purple = 5 # Places
|
||||||
Yellow = 6 # Not used for words
|
Yellow = 6 # Titles
|
||||||
|
Orange = 7 # Classes
|
||||||
|
|
||||||
def color(self):
|
def color(self):
|
||||||
return [
|
return [
|
||||||
"#b03334",
|
"#b03334",
|
||||||
"#6a5f31",
|
"#6a5f31",
|
||||||
"#4b7a28",
|
"#62a032",
|
||||||
"#297cb7",
|
"#297cb7",
|
||||||
"#767978",
|
"#767978",
|
||||||
"#623a75",
|
"#623a75",
|
||||||
"#f0de50",
|
"#bda627",
|
||||||
|
"#b76c2d",
|
||||||
][self.value]
|
][self.value]
|
||||||
|
|
||||||
class SolvedState(Enum):
|
class SolvedState(Enum):
|
||||||
@@ -144,11 +147,16 @@ def draw_page(page: Page, screen: pygame.surface.Surface, font: pygame.font.Font
|
|||||||
if page.text is not None:
|
if page.text is not None:
|
||||||
for i, t in enumerate(page.text):
|
for i, t in enumerate(page.text):
|
||||||
text = font.render(t,False,"#000000")
|
text = font.render(t,False,"#000000")
|
||||||
# x,y = text.get_size()
|
pos = Vector2(
|
||||||
screen.blit(text,(
|
|
||||||
page.position.x + PAGE_BORDER_WIDTH + TEXT_MARGIN,
|
page.position.x + PAGE_BORDER_WIDTH + TEXT_MARGIN,
|
||||||
page.position.y + PAGE_BORDER_WIDTH + TEXT_MARGIN + TEXT_TOP_MARGIN + i*(WORD_FONT_SIZE+TEXT_TOP_MARGIN)
|
page.position.y + PAGE_BORDER_WIDTH + TEXT_MARGIN + TEXT_TOP_MARGIN + i*(WORD_FONT_SIZE+TEXT_TOP_MARGIN)
|
||||||
))
|
)
|
||||||
|
if i == 0:
|
||||||
|
width,_ = text.get_size()
|
||||||
|
text = pygame.transform.scale2x(text)
|
||||||
|
pos.y = page.position.y + PAGE_BORDER_WIDTH + TEXT_MARGIN
|
||||||
|
pos.x = page.position.x + PAGE_BORDER_WIDTH + TEXT_MARGIN + (TEXT_WIDTH-width*2)//2
|
||||||
|
screen.blit(text,pos)
|
||||||
|
|
||||||
if page.slots != []:
|
if page.slots != []:
|
||||||
pygame.draw.circle(
|
pygame.draw.circle(
|
||||||
@@ -243,7 +251,7 @@ def draw_word(word: Word, screen: pygame.surface.Surface, font: pygame.font.Font
|
|||||||
))
|
))
|
||||||
|
|
||||||
def draw_tab(n: int, screen: pygame.surface.Surface, font: pygame.font.Font, selected: bool):
|
def draw_tab(n: int, screen: pygame.surface.Surface, font: pygame.font.Font, selected: bool):
|
||||||
pos = TAB_POS + Vector2((TAB_WIDTH+PAGE_MARGIN)*n,0)
|
pos = TAB_POS + Vector2((TAB_WIDTH+TAB_MARGIN)*n,0)
|
||||||
|
|
||||||
pygame.draw.rect(
|
pygame.draw.rect(
|
||||||
screen,
|
screen,
|
||||||
@@ -280,6 +288,7 @@ def main(data: dict):
|
|||||||
pygame.init()
|
pygame.init()
|
||||||
pygame.font.init()
|
pygame.font.init()
|
||||||
font = pygame.font.SysFont("Comic Code",WORD_FONT_SIZE,True)
|
font = pygame.font.SysFont("Comic Code",WORD_FONT_SIZE,True)
|
||||||
|
print(font.size(WORD_SLOT_SPACING))
|
||||||
screen = pygame.display.set_mode((1280, 720),pygame.RESIZABLE)
|
screen = pygame.display.set_mode((1280, 720),pygame.RESIZABLE)
|
||||||
drawer = pygame.surface.Surface((SCREEN_WIDTH, SCREEN_HEIGHT))
|
drawer = pygame.surface.Surface((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
@@ -289,7 +298,7 @@ def main(data: dict):
|
|||||||
pages = [word_page] + [
|
pages = [word_page] + [
|
||||||
Page(
|
Page(
|
||||||
False,
|
False,
|
||||||
[p],
|
p,
|
||||||
TEXT_PAGE_POS,
|
TEXT_PAGE_POS,
|
||||||
Vector2(TEXT_PAGE_WIDTH,TEXT_PAGE_HEIGHT),
|
Vector2(TEXT_PAGE_WIDTH,TEXT_PAGE_HEIGHT),
|
||||||
[]
|
[]
|
||||||
@@ -320,37 +329,42 @@ def main(data: dict):
|
|||||||
if width > TEXT_WIDTH:
|
if width > TEXT_WIDTH:
|
||||||
return text+[word]
|
return text+[word]
|
||||||
else:
|
else:
|
||||||
|
if text[-1] == "":
|
||||||
|
space = ""
|
||||||
text[-1] += space+word
|
text[-1] += space+word
|
||||||
return text
|
return text
|
||||||
|
|
||||||
for p in pages[1:]:
|
for p in pages[1:]:
|
||||||
new_text = [""]
|
new_text = []
|
||||||
text_words = p.text[0].split(" ")
|
for t in p.text:
|
||||||
for w in text_words:
|
new_text.append("")
|
||||||
res = re.findall(r"\[(.*?)\/(\d)\]([^\[])?",w)
|
text_words = t.split(" ")
|
||||||
if res == []:
|
for w in text_words:
|
||||||
new_text = add_to_text(new_text,w)
|
res = re.findall(r"\[(.*?)\/(\d)\]([^\[ ]*)",w)
|
||||||
else:
|
if res == []:
|
||||||
if new_text[0] != "":
|
new_text = add_to_text(new_text,w)
|
||||||
new_text = add_to_text(new_text,"")
|
else:
|
||||||
|
if new_text[0] != "":
|
||||||
|
new_text = add_to_text(new_text,"")
|
||||||
|
|
||||||
for slot in res:
|
for slot in res:
|
||||||
new_text = add_to_text(new_text,WORD_SLOT_SPACING,"")
|
new_text = add_to_text(new_text,WORD_SLOT_SPACING+slot[2],"")
|
||||||
height = WORD_FONT_SIZE*len(new_text)
|
height = WORD_FONT_SIZE*len(new_text)
|
||||||
width, _ = font.size(new_text[-1])
|
width, _ = font.size(new_text[-1])
|
||||||
new_text = add_to_text(new_text,slot[2],"")
|
extra_width, _ = font.size(slot[2])
|
||||||
pos = Vector2(
|
pos = Vector2(
|
||||||
TEXT_MARGIN + width - WORD_WIDTH,
|
TEXT_MARGIN + width - extra_width - WORD_WIDTH,
|
||||||
TEXT_MARGIN + height - WORD_HEIGHT//2 + TEXT_TOP_MARGIN*len(new_text)
|
TEXT_MARGIN + height - WORD_HEIGHT//2 + TEXT_TOP_MARGIN*len(new_text) + WORD_SLOT_NUDGE_DOWN
|
||||||
)
|
)
|
||||||
# if new_text[-1] != WORD_SLOT_SPACING+slot[2]:
|
# if new_text[-1] != WORD_SLOT_SPACING+slot[2]:
|
||||||
pos.x += WORD_SLOT_NUDGING
|
pos.x += WORD_SLOT_NUDGING
|
||||||
new_slot = WordSlot(WordColor(int(slot[1])),p,pos)
|
new_slot = WordSlot(WordColor(int(slot[1])),p,pos)
|
||||||
word_slots.append(new_slot)
|
word_slots.append(new_slot)
|
||||||
p.slots.append((slot[0],new_slot))
|
p.slots.append((slot[0].replace("%"," "),new_slot))
|
||||||
|
|
||||||
p.text = new_text
|
p.text = new_text
|
||||||
|
|
||||||
|
|
||||||
words: list[Word] = []
|
words: list[Word] = []
|
||||||
for i,w in enumerate(data["words"]):
|
for i,w in enumerate(data["words"]):
|
||||||
slot = word_slots[i]
|
slot = word_slots[i]
|
||||||
@@ -359,6 +373,12 @@ def main(data: dict):
|
|||||||
word.slot = slot
|
word.slot = slot
|
||||||
words.append(word)
|
words.append(word)
|
||||||
|
|
||||||
|
all_words = [w.word for w in words]
|
||||||
|
for p in pages:
|
||||||
|
not_present = [s[0] for s in p.slots if s[0] not in all_words]
|
||||||
|
if not_present:
|
||||||
|
print(not_present)
|
||||||
|
|
||||||
def focused():
|
def focused():
|
||||||
x, y = pygame.mouse.get_pos()
|
x, y = pygame.mouse.get_pos()
|
||||||
ratio_x = (screen.get_width() / drawer.get_width())
|
ratio_x = (screen.get_width() / drawer.get_width())
|
||||||
@@ -381,12 +401,12 @@ def main(data: dict):
|
|||||||
return w
|
return w
|
||||||
|
|
||||||
for i in range(len(pages)-1):
|
for i in range(len(pages)-1):
|
||||||
pos = TAB_POS + Vector2((TAB_WIDTH+PAGE_MARGIN)*i,0)
|
pos = TAB_POS + Vector2((TAB_WIDTH+TAB_MARGIN)*i,0)
|
||||||
rect = pygame.Rect(
|
rect = pygame.Rect(
|
||||||
pos.x - PAGE_MARGIN//2,
|
pos.x - TAB_MARGIN//2,
|
||||||
pos.y - PAGE_MARGIN//2,
|
pos.y - TAB_MARGIN//2,
|
||||||
TAB_WIDTH + PAGE_MARGIN,
|
TAB_WIDTH + TAB_MARGIN,
|
||||||
TAB_HEIGHT + PAGE_MARGIN
|
TAB_HEIGHT + TAB_MARGIN
|
||||||
)
|
)
|
||||||
if rect.collidepoint(scaled_xy):
|
if rect.collidepoint(scaled_xy):
|
||||||
return i+1
|
return i+1
|
||||||
@@ -505,10 +525,10 @@ def main(data: dict):
|
|||||||
frame = pygame.transform.scale(drawer,screen.get_size())
|
frame = pygame.transform.scale(drawer,screen.get_size())
|
||||||
screen.blit(frame,frame.get_rect())
|
screen.blit(frame,frame.get_rect())
|
||||||
|
|
||||||
if focused() is not None:
|
# if focused() is not None:
|
||||||
pygame.mouse.set_cursor(*pygame.cursors.tri_left)
|
# pygame.mouse.set_cursor(*pygame.cursors.tri_left)
|
||||||
else:
|
# else:
|
||||||
pygame.mouse.set_cursor(*pygame.cursors.arrow)
|
# pygame.mouse.set_cursor(*pygame.cursors.arrow)
|
||||||
|
|
||||||
# flip() the display to put your work on screen
|
# flip() the display to put your work on screen
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
|||||||
Reference in New Issue
Block a user