Skip to content

Commit

Permalink
Small code formatting to end the day
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkauzh committed Feb 18, 2024
1 parent 20bdd93 commit a43239c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ type AudioPlayer struct {
done chan bool
}

// Opens a audio file. It supports two file formats: WAV and MP3. Plays the audio file using Start function. Stop the audio file using Stop function. Close the audio file using Close function.
// Opens a audio file. It supports two file formats: WAV and MP3.
// Plays the audio file using Start function. Stop the audio file using Stop function.
// Close the audio file using Close function.
func OpenAudioFile(filePath string) AudioPlayer {
f, err := os.Open(filePath)
if err != nil {
Expand Down
21 changes: 18 additions & 3 deletions pkg/draw.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ func (r *Renderer2D) DrawRect(x, y, width, height float32, color [4]int) {
gl.Begin(gl.QUADS)
defer gl.End()

gl.Color4f(float32(color[0]/255), float32(color[1]/255), float32(color[2]/255), float32(color[3]/255))
gl.Color4f(
float32(color[0]/255),
float32(color[1]/255),
float32(color[2]/255),
float32(color[3]/255),
)
gl.Vertex2f(x, y)
gl.Vertex2f(x+width, y)
gl.Vertex2f(x+width, y+height)
Expand All @@ -16,7 +21,12 @@ func (r *Renderer2D) DrawRect(x, y, width, height float32, color [4]int) {

// Clears the screen whith the specific color that is provided
func (r *Renderer2D) ClearColor(color [4]int) {
gl.ClearColor(float32(color[0]/255), float32(color[1]/255), float32(color[2]/255), float32(color[3]/255))
gl.ClearColor(
float32(color[0]/255),
float32(color[1]/255),
float32(color[2]/255),
float32(color[3]/255),
)
}

// Draws a new line by the given x1, x2, y1, y2 and color
Expand All @@ -26,7 +36,12 @@ func (r *Renderer2D) DrawLine(x1, x2, y1, y2 float32, color [4]int) {
gl.Begin(gl.LINES)
defer gl.End()

gl.Color4f(float32(color[0]/255), float32(color[1]/255), float32(color[2]/255), float32(color[3]/255))
gl.Color4f(
float32(color[0]/255),
float32(color[1]/255),
float32(color[2]/255),
float32(color[3]/255),
)
gl.Vertex2f(x1, y1)
gl.Vertex2f(x2, y2)
}

0 comments on commit a43239c

Please sign in to comment.