Skip to content

Commit

Permalink
Stop auto packing, placeholder all screens
Browse files Browse the repository at this point in the history
  • Loading branch information
RPINerd committed Aug 20, 2024
1 parent 025fa07 commit a6dba3c
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 322 deletions.
290 changes: 42 additions & 248 deletions src/screens/commander_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
Shows your stats, time played, etc.
"""

import pygame
from tkinter import ttk

from ..constants import BKG_COLOR, GameStateID
# from ..constants import BKG_COLOR, GameStateID
from .screens import Screen

NO_QUARTER = "No quarters available"
Expand All @@ -16,275 +16,69 @@

class CommanderInfo(Screen):

def __init__(self, game) -> None:
self.game = game
self.head_font: pygame.font.Font = game.font_sm_bold
self.font: pygame.font.Font = game.font_sm
super().__init__(game)
def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
# self.pack(expand=True, fill="both")
# self.create_widgets()

def handle_events(self, event: pygame.event) -> None:
if event.type == pygame.QUIT:
self.game.running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.game.current_state = GameStateID.SPLASH
if event.key == pygame.K_b:
self.game.current_state = GameStateID.B_CARGO
if event.key == pygame.K_s:
self.game.current_state = GameStateID.S_CARGO
if event.key == pygame.K_y:
self.game.current_state = GameStateID.Y_SHIPYARD
if event.key == pygame.K_e:
self.game.current_state = GameStateID.BUY_EQUIPMENT
if event.key == pygame.K_q:
self.game.current_state = GameStateID.SELL_EQUIPMENT
if event.key == pygame.K_p:
self.game.current_state = GameStateID.PERSONNEL
if event.key == pygame.K_k:
self.game.current_state = GameStateID.BANK
if event.key == pygame.K_i:
self.game.current_state = GameStateID.SYSTEM_INFO
if event.key == pygame.K_c:
self.game.current_state = GameStateID.STATUS
if event.key == pygame.K_g:
self.game.current_state = GameStateID.GALACTIC_CHART
if event.key == pygame.K_w:
self.game.current_state = GameStateID.W_SHORTRANGE
if event.key == pygame.K_o:
NotImplemented
def create_widgets(self):

def update(self, actions) -> None:
pass

def render(self, canvas: pygame.Surface) -> pygame.Surface:
canvas.fill(BKG_COLOR)

# Draw the header
header = Header(canvas, self.font)
header.render()
title = TitleBar("Commander", self.head_font, canvas)
title.render()

return canvas
#! Placeholder id frame
self.id_frame = ttk.Frame(self)
ttk.Label(self.id_frame, text="Commander Info", font=("Palm Pilot Small", 24)).pack(fill="both", expand=True)


class ShipInfo(Screen):

def __init__(self, game) -> None:
self.game = game
self.head_font: pygame.font.Font = game.font_sm_bold
self.font: pygame.font.Font = game.font_sm
super().__init__(game)

def handle_events(self, event: pygame.event) -> None:
if event.type == pygame.QUIT:
self.game.running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.game.current_state = GameStateID.SPLASH
if event.key == pygame.K_b:
self.game.current_state = GameStateID.B_CARGO
if event.key == pygame.K_s:
self.game.current_state = GameStateID.S_CARGO
if event.key == pygame.K_y:
self.game.current_state = GameStateID.Y_SHIPYARD
if event.key == pygame.K_e:
self.game.current_state = GameStateID.BUY_EQUIPMENT
if event.key == pygame.K_q:
self.game.current_state = GameStateID.SELL_EQUIPMENT
if event.key == pygame.K_p:
self.game.current_state = GameStateID.PERSONNEL
if event.key == pygame.K_k:
self.game.current_state = GameStateID.BANK
if event.key == pygame.K_i:
self.game.current_state = GameStateID.SYSTEM_INFO
if event.key == pygame.K_c:
self.game.current_state = GameStateID.STATUS
if event.key == pygame.K_g:
self.game.current_state = GameStateID.GALACTIC_CHART
if event.key == pygame.K_w:
self.game.current_state = GameStateID.W_SHORTRANGE
if event.key == pygame.K_o:
NotImplemented

def update(self, actions) -> None:
pass
def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
# self.pack(expand=True, fill="both")
# self.create_widgets()

def render(self, canvas: pygame.Surface) -> pygame.Surface:
canvas.fill(BKG_COLOR)
def create_widgets(self):

# Draw the header
header = Header(canvas, self.font)
header.render()
title = TitleBar("Current Ship", self.head_font, canvas)
title.render()

return canvas
#! Placeholder id frame
self.id_frame = ttk.Frame(self)
ttk.Label(self.id_frame, text="Ship Info", font=("Palm Pilot Small", 24)).pack(fill="both", expand=True)


class SpecialCargo(Screen):

def __init__(self, game) -> None:
self.game = game
self.head_font: pygame.font.Font = game.font_sm_bold
self.font: pygame.font.Font = game.font_sm
super().__init__(game)

def handle_events(self, event: pygame.event) -> None:
if event.type == pygame.QUIT:
self.game.running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.game.current_state = GameStateID.SPLASH
if event.key == pygame.K_b:
self.game.current_state = GameStateID.B_CARGO
if event.key == pygame.K_s:
self.game.current_state = GameStateID.S_CARGO
if event.key == pygame.K_y:
self.game.current_state = GameStateID.Y_SHIPYARD
if event.key == pygame.K_e:
self.game.current_state = GameStateID.BUY_EQUIPMENT
if event.key == pygame.K_q:
self.game.current_state = GameStateID.SELL_EQUIPMENT
if event.key == pygame.K_p:
self.game.current_state = GameStateID.PERSONNEL
if event.key == pygame.K_k:
self.game.current_state = GameStateID.BANK
if event.key == pygame.K_i:
self.game.current_state = GameStateID.SYSTEM_INFO
if event.key == pygame.K_c:
self.game.current_state = GameStateID.STATUS
if event.key == pygame.K_g:
self.game.current_state = GameStateID.GALACTIC_CHART
if event.key == pygame.K_w:
self.game.current_state = GameStateID.W_SHORTRANGE
if event.key == pygame.K_o:
NotImplemented

def update(self, actions) -> None:
pass

def render(self, canvas: pygame.Surface) -> pygame.Surface:
canvas.fill(BKG_COLOR)
def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
# self.pack(expand=True, fill="both")
# self.create_widgets()

# Draw the header
header = Header(canvas, self.font)
header.render()
title = TitleBar("Special Cargo", self.head_font, canvas)
title.render()
def create_widgets(self):

return canvas
#! Placeholder id frame
self.id_frame = ttk.Frame(self)
ttk.Label(self.id_frame, text="Special Cargo", font=("Palm Pilot Small", 24)).pack(fill="both", expand=True)


class Personnel(Screen):

def __init__(self, game) -> None:
self.game = game
self.head_font: pygame.font.Font = game.font_sm_bold
self.font: pygame.font.Font = game.font_sm
super().__init__(game)
def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
# self.pack(expand=True, fill="both")
# self.create_widgets()

def handle_events(self, event: pygame.event) -> None:
if event.type == pygame.QUIT:
self.game.running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.game.current_state = GameStateID.SPLASH
if event.key == pygame.K_b:
self.game.current_state = GameStateID.B_CARGO
if event.key == pygame.K_s:
self.game.current_state = GameStateID.S_CARGO
if event.key == pygame.K_y:
self.game.current_state = GameStateID.Y_SHIPYARD
if event.key == pygame.K_e:
self.game.current_state = GameStateID.BUY_EQUIPMENT
if event.key == pygame.K_q:
self.game.current_state = GameStateID.SELL_EQUIPMENT
if event.key == pygame.K_p:
self.game.current_state = GameStateID.PERSONNEL
if event.key == pygame.K_k:
self.game.current_state = GameStateID.BANK
if event.key == pygame.K_i:
self.game.current_state = GameStateID.SYSTEM_INFO
if event.key == pygame.K_c:
self.game.current_state = GameStateID.STATUS
if event.key == pygame.K_g:
self.game.current_state = GameStateID.GALACTIC_CHART
if event.key == pygame.K_w:
self.game.current_state = GameStateID.W_SHORTRANGE
if event.key == pygame.K_o:
NotImplemented
def create_widgets(self):

def update(self, actions) -> None:
pass

def render(self, canvas: pygame.Surface) -> pygame.Surface:
canvas.fill(BKG_COLOR)

# Draw the header
header = Header(canvas, self.font)
header.render()
title = TitleBar("Personnel Roster", self.head_font, canvas)
title.render()

# Draw the dividers
divider(canvas, 63)
divider(canvas, 108)

TextRender("Cash: {} cr.", (154, 158), self.font, ref="bottomright").draw(canvas)

return canvas
#! Placeholder id frame
self.id_frame = ttk.Frame(self)
ttk.Label(self.id_frame, text="Personnel", font=("Palm Pilot Small", 24)).pack(fill="both", expand=True)


class Quests(Screen):

def __init__(self, game) -> None:
self.game = game
self.head_font: pygame.font.Font = game.font_sm_bold
self.font: pygame.font.Font = game.font_sm
super().__init__(game)

def handle_events(self, event: pygame.event) -> None:
if event.type == pygame.QUIT:
self.game.running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.game.current_state = GameStateID.SPLASH
if event.key == pygame.K_b:
self.game.current_state = GameStateID.B_CARGO
if event.key == pygame.K_s:
self.game.current_state = GameStateID.S_CARGO
if event.key == pygame.K_y:
self.game.current_state = GameStateID.Y_SHIPYARD
if event.key == pygame.K_e:
self.game.current_state = GameStateID.BUY_EQUIPMENT
if event.key == pygame.K_q:
self.game.current_state = GameStateID.SELL_EQUIPMENT
if event.key == pygame.K_p:
self.game.current_state = GameStateID.PERSONNEL
if event.key == pygame.K_k:
self.game.current_state = GameStateID.BANK
if event.key == pygame.K_i:
self.game.current_state = GameStateID.SYSTEM_INFO
if event.key == pygame.K_c:
self.game.current_state = GameStateID.STATUS
if event.key == pygame.K_g:
self.game.current_state = GameStateID.GALACTIC_CHART
if event.key == pygame.K_w:
self.game.current_state = GameStateID.W_SHORTRANGE
if event.key == pygame.K_o:
NotImplemented

def update(self, actions) -> None:
pass

def render(self, canvas: pygame.Surface) -> pygame.Surface:
canvas.fill(BKG_COLOR)
def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
# self.pack(expand=True, fill="both")
# self.create_widgets()

# Draw the header
header = Header(canvas, self.font)
header.render()
title = TitleBar("Quests", self.head_font, canvas)
title.render()
def create_widgets(self):

return canvas
#! Placeholder id frame
self.id_frame = ttk.Frame(self)
ttk.Label(self.id_frame, text="Quests", font=("Palm Pilot Small", 24)).pack(fill="both", expand=True)
10 changes: 5 additions & 5 deletions src/screens/markets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BuyCargo(Screen):

def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
self.pack(expand=True, fill="both")
# self.pack(expand=True, fill="both")
# self.create_widgets()

def create_widgets(self):
Expand All @@ -29,7 +29,7 @@ class SellCargo(Screen):

def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
self.pack(expand=True, fill="both")
# self.pack(expand=True, fill="both")
# self.create_widgets()

def create_widgets(self):
Expand All @@ -43,7 +43,7 @@ class BuyEquipment(Screen):

def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
self.pack(expand=True, fill="both")
# self.pack(expand=True, fill="both")
# self.create_widgets()

def create_widgets(self):
Expand All @@ -57,7 +57,7 @@ class SellEquipment(Screen):

def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
self.pack(expand=True, fill="both")
# self.pack(expand=True, fill="both")
# self.create_widgets()

def create_widgets(self):
Expand All @@ -71,7 +71,7 @@ class Bank(Screen):

def __init__(self, parent, screen_title, manager) -> None:
super().__init__(parent, screen_title, manager)
self.pack(expand=True, fill="both")
# self.pack(expand=True, fill="both")
# self.create_widgets()

def create_widgets(self):
Expand Down
Loading

0 comments on commit a6dba3c

Please sign in to comment.