ILoggable

A place to keep my thoughts on programming

July 16, 2007 .net, geek , , ,

Time Monitor example

There was a request for a Time Monitor app that would show splits and the lap time including delta’s. Currently LFS, shows you your splits and laps, but only briefly and without any information about how it compares to the previous lap. But with the LFS button system, custom HUD elements can now be created relatively simply. Really, “Button” is a misnomer. It’s really a label control that can be set to clickable.

I figured the time monitor would be a good example to use the RaceTracker class I wrote a couple of days ago and exercise the button system to display the data gathered by the tracker. The resulting app, is a relatively simple winforms sample (the UI exists purely for configuration) that produces LFS stats like this (click image for full screenshot):

The UI for the app itself just lets the user specify how to connect to LFS

The app is not meant for LFS servers, but as a local Aid for clients. It connects to a client instance and displays the buttons locally, according to the currently viewed player Id. I.e. it switches the hud as you tab through the players. It won’t start displaying anything until it hits a first split (i.e. if you just connected and the viewed player has already past the first split, no statistics for the player will show up until the next split 1 pass.

The code is a Visual Studio Solution, created in VS 2005, although it should work fine in Visual Studio Express. It can be downloaded from here. It’s written in C# and uses the LFSLib.NET library for InSim connectivity. It’s not meant to be an App, and you won’t get any support from me for the binary. You can run it as is, but it’s meant to show how LFSLib.NET can be used for tracking and creating buttons. As such, this is example code and completely free of any license (LFSLib.NET is still governed by the GPL, though). Use it however you wish.

Leave a comment