Skip to content

Commit

Permalink
Several new projects and project content
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterofbread committed May 10, 2024
1 parent 236c2fa commit 615d8bc
Show file tree
Hide file tree
Showing 109 changed files with 939 additions and 41 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
resources/
# Generated files by hugo
/public/
/resources/_gen/
/assets/jsconfig.json
hugo_stats.json
32 changes: 8 additions & 24 deletions content/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ cascade:
github_user: "toasterofbread"
---

{{< rawhtml >}}
<div style="display: flex; gap: 20px; margin-bottom: 50px;">
<img src="https://i.ytimg.com/vi/kB2QZ1A3Tyg/hqdefault.jpg" style="max-height: 130px; margin: 0; transform: scaleX(-1);">
<div>
<h3 style="margin-bottom: 10px;">Site under construction</h3>
TODO:
<ul style="font-size: 0.7em">
<li>More projects</li>
<li>More content for projects</li>
<li>Japanese translations</li>
</ul>
</div>
</div>
{{< /rawhtml>}}

{{< listeningto >}}

`$ whoami`
Expand Down Expand Up @@ -99,41 +84,40 @@ I make stuff for fun and put it on the Internet. I've been programming on and of
</div>

<div>
<h4>Frameworks</h4>
<h4>Frameworks / platforms</h4>
<ul>
<li><a href="projects?tag=Godot">Godot Engine</a></li>
<li><a href="projects?tag=Jetpack+Compose">Jetpack Compose</a></li>
<li><a href="projects?tag=Compose">Jetpack Compose (multiplatform)</a></li>
<li><a href="projects?tag=Raylib">Raylib</a></li>
<li><a href="projects?tag=Android">Android</a></li>
</ul>
</div>

<div>
<h4>Other technologies</h4>
<h4>Other Things I've dabbled in</h4>
<ul>
<li><a href="projects?tag=GCloud">Google Cloud & Firebase</a></li>
<li><a href="projects?tag=VR">Virtual reality</a></li>
<li><a href="projects?tag=Discord">Discord</a></li>
<li><a href="projects?tag=Android">Android</a></li>
</ul>
</div>

<div>
<h4>Spoken languages</h4>
<ul>
<li>English (fluent)</li>
<li><a href="projects?tag=Japanese">Japanese</a> (fluent)</li>
<li>English (native)</li>
<li>Japanese (fluent)</li>
</ul>
</div>
</div>

<br>
<br>

<code>$ ls <a href="/en/projects">/projects</a></code>
<code>$ ls <a href="/en/projects">/projects</a> | head -5</code>

{{< /rawhtml >}}

{{< bookcase section="/projects" row=true preview=true >}}
{{< bookcase section="/projects" row=true preview=true limit=5 >}}

<!-- {{< rawhtml >}}
<code>$ curl https://status.toastbits.dev/song > <a href="/en/about">/about</a></code>
Expand Down
8 changes: 7 additions & 1 deletion content/about/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ footer_suffix: " Streak image generated using <a href='https://github.com/akerl/

The source code of this website is available at [https://github.com/toasterofbread/toastbits](https://github.com/toasterofbread/toastbits).

# Contact

Email: talohalton@gmail.com

Discord: [burnerofbread](https://discord.com/users/402344993391640578)

{{< rawhtml >}}

<div style="width: 90%; margin: auto;">
<div style="width: 90%; margin: auto; padding-top: 100px;">
<picture>
<a href="/github"><img width=100% src="https://ghchart.rshah.org/toasterofbread"></a>
</picture>
Expand Down
3 changes: 2 additions & 1 deletion content/projects/godot-android-webview/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ images: [
"/projects/godot-android-webview/images/compose.png",
"/projects/godot-android-webview/images/webview.png"
]
background_image: "/projects/godot-android-webview/background.svg"
hide_in_preview: true
background_image: "/background-generic.svg"
accent_colour_light: "#c7c7c7"
accent_colour_dark: "#383838"

Expand Down
2 changes: 1 addition & 1 deletion content/projects/kakutroid/_index.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Kakutroid"
description: "A Metroidvania with simple geometric graphics and Celeste-inspired movement. Another project I planned to finish and release but was never able to."
description: "An (unfinished) Metroidvania with simple geometric graphics and Celeste-inspired movement."

github_repo: "Kakutroid"
source_code: "https://github.com/toasterofbread/Kakutroid"
Expand Down
10 changes: 6 additions & 4 deletions content/projects/liverail/_index.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "LiveRail"
description: "This is a school project"
description: "A-Level computer science project. Top-down simulation of a railway using real-world timetable and map data."

github_repo: "LiveRail"
source_code: "https://github.com/toasterofbread/LiveRail/"
Expand All @@ -17,13 +17,15 @@ end_year: 2024
end_month: 4
publishdate: 2024-02-13

images: []
background_image: ""
images: ["/projects/liverail/0.png", "/projects/liverail/1.png"]
background_image: "/projects/liverail/background.svg"
accent_colour_light: "#77b64d"
accent_colour_dark: "#42662a"
---

{{< projecttheme >}}
{{< projectheader >}}

## [Development log](log)
The final report for this project can be read on the GitHub repository.

## [(Partial) development log](log)
156 changes: 156 additions & 0 deletions content/projects/liverail/annotated_code/MapDisplay.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
extends Node2D
class_name MapDisplay

const SCALE: float = 0.01

@onready var map_node: Node = $Map

var map: Map = null
var rail_segment_lines: Array[RailSegmentLine] = []

var timetable: TT.Timetable = null
var timetable_stations: Dictionary = null # [ TT.Station, MapNode ]

var time_thread: Thread = null
var time_s: float = null
var train_positions: Dictionary = {} # [ TT.TrainService, Vector2 ]

"""
Sets the time used by the update thread and queues a redraw
The update thread is started if not already running
"""
func setTime(time_s: float):
if self.time_s == null:
self.time_s = time_s

time_thread = Thread.new()
time_thread.start(_trainPositionUpdateLoop)
else:
self.time_s = time_s

queue_redraw()

"""
Adds RailSegmentLines and station previews matching the passed map
Nodes previously added by this function are removed
"""
func setMap(map: Map):
self.map = map

rail_segment_lines.clear()
for child in map_node.get_children():
child.queue_free()

if map == null:
return

for rail_line in map.rail_lines:
for rail_segment in rail_line.segments:
if rail_segment.names.is_empty():
continue

var line: RailSegmentLine = RailSegmentLine.new()
line.applyRailSegment(rail_segment, rail_line)

rail_segment_lines.append(line)
map_node.add_child(line)

for station in rail_line.stations:
var sprite = Sprite2D.new()
sprite.texture = preload("res://icon.svg")
sprite.global_position = station.pos * 0.01
sprite.scale = Vector2.ONE * 0.05
map_node.add_child(sprite)

"""
Sets the timetable to be used by the train position update thread
Must be called after setMap
"""
func setTimetable(timetable: TT.Timetable):
self.timetable = timetable
if timetable == null:
timetable_stations = null
return

assert(map != null)

timetable_stations = {}

for rail_line in map.rail_lines:
for station in rail_line.stations:
var timetable_station: TT.Station = null
for name in [station.name] + station.names.values():
for st in timetable.stations:
if st in name or name in st:
timetable_station = timetable.stations[st]
break
if timetable_station != null:
break

if timetable_station == null:
push_error("No timetable station found for ", station)
return

timetable_stations[timetable_station] = station

func _ready():
$Camera2D.ZoomLevelChanged.connect(onCameraZoomLevelChanged)

func _exit_tree():
if time_thread != null:
time_s = null
time_thread.wait_to_finish()
time_thread = null

func _process(delta: float):
if Input.is_action_just_pressed("click"):
_onClick()

func onCameraZoomLevelChanged(zoom_level: float):
for line in rail_segment_lines:
line.onCameraZoomLevelChanged(zoom_level)

func _draw():
for position in train_positions.values():
if position == null:
break
draw_circle(position * MapDisplay.SCALE, 3, Color.WHITE)

func _onClick():
var mouse_position: Vector2 = get_global_mouse_position()

var touching: Array[RailSegmentLine] = []
for line in rail_segment_lines:
if line.isTouchingCursor():
touching.append(line)

if touching.is_empty():
return
if touching.size() == 1:
_onRailSegmentLineClicked(touching[0])
return

var closest: RailSegmentLine = null
var closest_distance: float = null

for line in touching:
var distance = line.getTouchingCursorDistance(mouse_position)

if closest == null || distance < closest_distance:
closest = line
closest_distance = distance

_onRailSegmentLineClicked(closest)

func _onRailSegmentLineClicked(rail_segment_line: RailSegmentLine):
print(rail_segment_line.rail_segment.names)

func _trainPositionUpdateLoop():
while true:
var time_s: float = self.time_s
if time_s == null:
break

self.train_positions = TrainPosition.calculateMapTrainPositions(
time_s, map, timetable, timetable_stations
)
Loading

0 comments on commit 615d8bc

Please sign in to comment.