Skip to content

Commit

Permalink
fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
fluffy-melli committed Nov 18, 2024
1 parent edc5f6b commit a4af93d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ start.sh --nogui --play [URL1] [URL2]...
| `` | Rewind 15s |
| `` | Forward 15s |

### Function

| Key | Function |
| ----- | ---------- |
| `f11` | Fullscreen |


## 🔍 Search Interface

- Enter video URL or search term
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ start.sh --play [URL1] [URL2]...
| `` | 15초 되감기 |
| `` | 15초 앞으로 |

### 기능

|| 기능 |
| ----- | ------- |
| `f11` | 전체화면 |

## 🔍 검색 인터페이스

- 비디오 URL 또는 검색어 입력
Expand Down
13 changes: 12 additions & 1 deletion src/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class VideoState:
search: str = ""
search_width: int = 0
search_height: int = 0
fullscreen: bool = False
display_width: int = 0
display_height: int = 0
ascii_width: int = 80
msg_start_time: float = 0
msg_text: str = ""
Expand Down Expand Up @@ -110,6 +113,12 @@ def handle_key_event(key: str) -> None:
seek_amount = 15 if key == "right" else -15
src.win.screen.vid.seek(seek_amount)
state.msg_text = f"Seek: {seek_amount:+d}s"
elif key == "f11":
state.fullscreen = not state.fullscreen
if not state.fullscreen:
src.win.screen.reset((src.win.screen.vid.current_size[0], src.win.screen.vid.current_size[1]+5))
else:
src.win.screen.reset((state.display_width,state.display_height))
elif key == "a":
toggle_ascii_mode()
state.msg_text = "ASCII Mode" if state.ascii_mode else "Normal Mode"
Expand Down Expand Up @@ -245,7 +254,9 @@ def run(url: str):
def wait():
global state
screen_info = pygame.display.Info()
state.search_width = screen_info.current_w // 2
state.display_width = screen_info.current_w
state.display_height = screen_info.current_h
state.search_width = state.display_width // 2
state.search_height = int(state.search_width * (9 / 16))
os.environ['SDL_VIDEO_CENTERED'] = '1'
if src.win.screen.vid is None:
Expand Down

0 comments on commit a4af93d

Please sign in to comment.