mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-13 05:53:00 +00:00
better drawing of possession football indicator
This commit is contained in:
@@ -680,8 +680,10 @@ class NCAAFBLiveManager(BaseNCAAFBManager): # Renamed class
|
|||||||
# Possession Indicator (small football icon)
|
# Possession Indicator (small football icon)
|
||||||
possession = game.get("possession_indicator")
|
possession = game.get("possession_indicator")
|
||||||
if possession: # Only draw if possession is known
|
if possession: # Only draw if possession is known
|
||||||
ball_radius = 2
|
ball_radius_x = 3 # Wider for football shape
|
||||||
|
ball_radius_y = 2 # Shorter for football shape
|
||||||
ball_color = (139, 69, 19) # Brown color for the football
|
ball_color = (139, 69, 19) # Brown color for the football
|
||||||
|
lace_color = (255, 255, 255) # White for laces
|
||||||
|
|
||||||
# Approximate height of the detail font (4x6 font at size 6 is roughly 6px tall)
|
# Approximate height of the detail font (4x6 font at size 6 is roughly 6px tall)
|
||||||
detail_font_height_approx = 6
|
detail_font_height_approx = 6
|
||||||
@@ -691,21 +693,25 @@ class NCAAFBLiveManager(BaseNCAAFBManager): # Renamed class
|
|||||||
|
|
||||||
if possession == "away":
|
if possession == "away":
|
||||||
# Position ball to the left of D&D text
|
# Position ball to the left of D&D text
|
||||||
ball_x_center = dd_x - possession_ball_padding - ball_radius
|
ball_x_center = dd_x - possession_ball_padding - ball_radius_x
|
||||||
elif possession == "home":
|
elif possession == "home":
|
||||||
# Position ball to the right of D&D text
|
# Position ball to the right of D&D text
|
||||||
ball_x_center = dd_x + dd_width + possession_ball_padding + ball_radius
|
ball_x_center = dd_x + dd_width + possession_ball_padding + ball_radius_x
|
||||||
else:
|
else:
|
||||||
ball_x_center = 0 # Should not happen / no indicator
|
ball_x_center = 0 # Should not happen / no indicator
|
||||||
|
|
||||||
if ball_x_center > 0: # Draw if position is valid
|
if ball_x_center > 0: # Draw if position is valid
|
||||||
|
# Draw the football shape (ellipse)
|
||||||
draw_overlay.ellipse(
|
draw_overlay.ellipse(
|
||||||
(ball_x_center - ball_radius, ball_y_center - ball_radius,
|
(ball_x_center - ball_radius_x, ball_y_center - ball_radius_y, # x0, y0
|
||||||
ball_x_center + ball_radius, ball_y_center + ball_radius),
|
ball_x_center + ball_radius_x, ball_y_center + ball_radius_y), # x1, y1
|
||||||
fill=ball_color, outline=(0,0,0)
|
fill=ball_color, outline=(0,0,0)
|
||||||
)
|
)
|
||||||
# Optionally, add a small white stitch mark
|
# Draw a simple horizontal lace
|
||||||
# draw_overlay.line((ball_x_center, ball_y_center - ball_radius, ball_x_center, ball_y_center + ball_radius), fill=(255,255,255), width=1)
|
draw_overlay.line(
|
||||||
|
(ball_x_center - 1, ball_y_center, ball_x_center + 1, ball_y_center),
|
||||||
|
fill=lace_color, width=1
|
||||||
|
)
|
||||||
|
|
||||||
# Timeouts (Bottom corners) - 3 small bars per team
|
# Timeouts (Bottom corners) - 3 small bars per team
|
||||||
timeout_bar_width = 4
|
timeout_bar_width = 4
|
||||||
|
|||||||
@@ -666,8 +666,10 @@ class NFLLiveManager(BaseNFLManager): # Renamed class
|
|||||||
# Possession Indicator (small football icon)
|
# Possession Indicator (small football icon)
|
||||||
possession = game.get("possession_indicator")
|
possession = game.get("possession_indicator")
|
||||||
if possession: # Only draw if possession is known
|
if possession: # Only draw if possession is known
|
||||||
ball_radius = 2
|
ball_radius_x = 3 # Wider for football shape
|
||||||
|
ball_radius_y = 2 # Shorter for football shape
|
||||||
ball_color = (139, 69, 19) # Brown color for the football
|
ball_color = (139, 69, 19) # Brown color for the football
|
||||||
|
lace_color = (255, 255, 255) # White for laces
|
||||||
|
|
||||||
# Approximate height of the detail font (4x6 font at size 6 is roughly 6px tall)
|
# Approximate height of the detail font (4x6 font at size 6 is roughly 6px tall)
|
||||||
detail_font_height_approx = 6
|
detail_font_height_approx = 6
|
||||||
@@ -677,21 +679,25 @@ class NFLLiveManager(BaseNFLManager): # Renamed class
|
|||||||
|
|
||||||
if possession == "away":
|
if possession == "away":
|
||||||
# Position ball to the left of D&D text
|
# Position ball to the left of D&D text
|
||||||
ball_x_center = dd_x - possession_ball_padding - ball_radius
|
ball_x_center = dd_x - possession_ball_padding - ball_radius_x
|
||||||
elif possession == "home":
|
elif possession == "home":
|
||||||
# Position ball to the right of D&D text
|
# Position ball to the right of D&D text
|
||||||
ball_x_center = dd_x + dd_width + possession_ball_padding + ball_radius
|
ball_x_center = dd_x + dd_width + possession_ball_padding + ball_radius_x
|
||||||
else:
|
else:
|
||||||
ball_x_center = 0 # Should not happen / no indicator
|
ball_x_center = 0 # Should not happen / no indicator
|
||||||
|
|
||||||
if ball_x_center > 0: # Draw if position is valid
|
if ball_x_center > 0: # Draw if position is valid
|
||||||
|
# Draw the football shape (ellipse)
|
||||||
draw_overlay.ellipse(
|
draw_overlay.ellipse(
|
||||||
(ball_x_center - ball_radius, ball_y_center - ball_radius,
|
(ball_x_center - ball_radius_x, ball_y_center - ball_radius_y, # x0, y0
|
||||||
ball_x_center + ball_radius, ball_y_center + ball_radius),
|
ball_x_center + ball_radius_x, ball_y_center + ball_radius_y), # x1, y1
|
||||||
fill=ball_color, outline=(0,0,0)
|
fill=ball_color, outline=(0,0,0)
|
||||||
)
|
)
|
||||||
# Optionally, add a small white stitch mark
|
# Draw a simple horizontal lace
|
||||||
# draw_overlay.line((ball_x_center, ball_y_center - ball_radius, ball_x_center, ball_y_center + ball_radius), fill=(255,255,255), width=1)
|
draw_overlay.line(
|
||||||
|
(ball_x_center - 1, ball_y_center, ball_x_center + 1, ball_y_center),
|
||||||
|
fill=lace_color, width=1
|
||||||
|
)
|
||||||
|
|
||||||
# Timeouts (Bottom corners) - 3 small bars per team
|
# Timeouts (Bottom corners) - 3 small bars per team
|
||||||
timeout_bar_width = 4
|
timeout_bar_width = 4
|
||||||
|
|||||||
Reference in New Issue
Block a user