Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions RaceOverlay/Data/Mapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ public static iRacingData MapData(IRacingSdk irsdkSharper)
// ignored
}

// P2P (Indycar Only)
try
{
data.LocalCarTelemetry.P2PLeft = irsdkSharper.Data.GetFloat("P2P_Count");
data.LocalCarTelemetry.P2POn = irsdkSharper.Data.GetBool("P2P_Status");
}
catch (Exception e)
{
// ignored
}


// Lap Data
data.LocalCarTelemetry.Lap = irsdkSharper.Data.GetInt("Lap");
Expand Down
4 changes: 4 additions & 0 deletions RaceOverlay/Data/Models/LocalCarTelemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public LocalCarTelemetry()
// Battery (GPT Only)
public float EngeryLevelPct { get; set; } = 0;

// Indy car Series Only
public float P2PLeft { get; set; } = 0; // P2P = Push to Pass, only available in Indy car series
public bool P2POn { get; set; } = false; // P2P = Push to Pass, only available in Indy car series

// Lap data
public int Lap { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions RaceOverlay/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using RaceOverlay.Overlays.FuelCalculator;
using RaceOverlay.Overlays.LaptimeDelta;
using RaceOverlay.Overlays.Leaderboard;
using RaceOverlay.Overlays.P2PInfo;
using RaceOverlay.Overlays.PitstopInfo;
using RaceOverlay.Overlays.Relative;
using RaceOverlay.Overlays.WeatherInfo;
Expand Down Expand Up @@ -70,6 +71,7 @@ private void _initOverlays()
Overlays.Add(new Inputs());
Overlays.Add(new LaptimeDelta());
Overlays.Add(new Standings());
Overlays.Add(new P2PInfo());
Overlays.Add(new PitstopInfo());
Overlays.Add(new Relative());
//Overlays.Add(new SessionInfo());
Expand Down
68 changes: 68 additions & 0 deletions RaceOverlay/Overlays/P2PInfo/P2PInfo.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<internals:Overlay x:Class="RaceOverlay.Overlays.P2PInfo.P2PInfo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:RaceOverlay.Overlays.P2PInfo"
xmlns:internals="clr-namespace:RaceOverlay.Internals"
mc:Ignorable="d"
Title="P2PInfo" Height="{Binding _windowHeight}" Width="{Binding _windowWidth}"
Background="Transparent"
WindowStyle="None"
WindowStartupLocation="Manual"
ResizeMode="NoResize"
Topmost="True">
<Border Background="#FF1E1E1E" CornerRadius="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>

<Grid.LayoutTransform>
<ScaleTransform x:Name="ContentScaleTransform" ScaleX="1" ScaleY="1" />
</Grid.LayoutTransform>

<Grid Height="35">
<Rectangle Width="200"
Height="35"
Fill="#FF2A2A2A"
RadiusX="10"
RadiusY="10"/>
<Rectangle x:Name="P2PBar"
Width="150"
Height="35"
Fill="#FF0000FF"
VerticalAlignment="Bottom"
HorizontalAlignment="Left"
RadiusX="10"
RadiusY="10"/>

<Path Stroke="White" StrokeThickness="2" Fill="White" VerticalAlignment="Center" Margin="10,0,0,0" Name="P2PActive" Visibility="Collapsed">
<Path.Data>
<!-- M = Move, L = Line, Z = Close path -->
<PathGeometry Figures="M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09z" />
</Path.Data>
</Path>

<Path Stroke="White" StrokeThickness="1" Fill="White" VerticalAlignment="Center" Margin="10,0,0,0" Name="P2PInactive" Visibility="Visible">
<Path.Data>
<!-- M = Move, L = Line, Z = Close path -->
<PathGeometry Figures="M11.251.068a.5.5 0 0 1 .227.58L9.677 6.5H13a.5.5 0 0 1 .364.843l-8 8.5a.5.5 0 0 1-.842-.49L6.323 9.5H3a.5.5 0 0 1-.364-.843l8-8.5a.5.5 0 0 1 .615-.09zM4.157 8.5H7a.5.5 0 0 1 .478.647L6.11 13.59l5.732-6.09H9a.5.5 0 0 1-.478-.647L9.89 2.41z" />
</Path.Data>
</Path>

<TextBlock Name="P2PText"
Text="125"
Foreground="White"
FontSize="20"
VerticalAlignment="Center"
HorizontalAlignment="Center"
>

</TextBlock>
</Grid>

</Grid>
</Border>
</internals:Overlay>
73 changes: 73 additions & 0 deletions RaceOverlay/Overlays/P2PInfo/P2PInfo.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System.Diagnostics;
using System.Windows;
using RaceOverlay.Internals;

namespace RaceOverlay.Overlays.P2PInfo;

public partial class P2PInfo : Overlay
{
private float _p2pLeft;
private bool _p2pOn;

public P2PInfo(): base("P2P Info", "Displays the current P2P status and remaining time.")
{
InitializeComponent();
_setWindowSize(200, 35);
Thread updateThread = new Thread(UpdateThreadMethod);
updateThread.IsBackground = true;
updateThread.Start();
}

public override void _updateWindow()
{
if (_p2pLeft > 200)
{
P2PBar.Width = 200;
}
else
{
P2PBar.Width = _p2pLeft;
}

P2PText.Text = _p2pLeft.ToString("f0");
if (_p2pOn)
{
P2PActive.Visibility = Visibility.Visible;
P2PInactive.Visibility = Visibility.Collapsed;
}
{
P2PActive.Visibility = Visibility.Collapsed;
P2PInactive.Visibility = Visibility.Visible;
}


}

public override void _getData()
{
if (_devMode)
{
InCar = true;
}
else
{
InCar = MainWindow.IRacingData.InCar;
}

_p2pLeft = MainWindow.IRacingData.LocalCarTelemetry.P2PLeft;
_p2pOn = MainWindow.IRacingData.LocalCarTelemetry.P2POn;
}

protected override void _scaleWindow(double scale)
{
try
{
ContentScaleTransform.ScaleX = scale;
ContentScaleTransform.ScaleY = scale;
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
}
Loading