Skip to content

On screen logging#121

Merged
pawaskar-shreya merged 7 commits into
mainfrom
mwd-logging
Sep 15, 2025
Merged

On screen logging#121
pawaskar-shreya merged 7 commits into
mainfrom
mwd-logging

Conversation

@mdales
Copy link
Copy Markdown
Collaborator

@mdales mdales commented Sep 13, 2025

This PR attempts to address #93 and #91 - moving logging from Claudius from the terminal into the Claudius display. This turned out to be more messy that I'd anticipated, as it exposed some side-effecty bits of code and global state.

  • Removed global variables from base.ml into a state type that is not global, but part of the main inner loop.
  • Added logging structure to Stats.mli to hold log messages
  • Unifies the input for handling F keys
  • Updated Stats.render to draw logging
  • Updated parts of Claudius that used Printf.printf to instead return a result type that has an error message which can be logged.
  • Added code to Palette.t to work out two most visually different colours
  • Code churn in Palette.t to reduce pollution of Int32.t
  • Adds hsluv as a dependancy for colour space conversion

Comment thread src/palette.ml
type t = int32 array
type t = { colors : int32 array; distinctive_pair : int * int }

let delta_e (luv1 : Hsluv.luv) (luv2 : Hsluv.luv) =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got introduced to a new library! 🙌🙌

Copy link
Copy Markdown
Collaborator

@pawaskar-shreya pawaskar-shreya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such a great addition to CLaudius. 🤩💫

Feels like a lot of features are being delicately tied together to have this log stats rendered to the sdl window.

And the idea with the color space is such a cool thing!

Firstly it is visually better than a single color being used in terms of visibility and secondly, it looks so much better with 2 colors being used for the log, one for the text body and other for the border. This again fits so perfectly with our theme for a retro console! 🤖

Such a cool PR this is! 🫡

@pawaskar-shreya pawaskar-shreya merged commit 123ca9b into main Sep 15, 2025
1 check passed
@mdales mdales deleted the mwd-logging branch September 16, 2025 06:23
This was referenced Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants