Skip to content

Instantly share code, notes, and snippets.

@mfkl
mfkl / gamdev
Last active June 13, 2024 13:23
https://docs.google.com/presentation/d/1n6O1u5WtlxKIW218jqC31aBVV7pl1VmU4mGHmp8CyaY/edit?usp=sharing
https://we.tl/t-sCXDwiuTsQ
.\LVST.exe --help
LVST 1.0.0
Copyright (C) 2020 LVST
-v, --verbose Set output to verbose messages.
-t, --torrent The torrent link to download and play
-c, --cast Cast to the chromecast
/// <summary>
/// Retrieve a video frame from the Unity plugin as a texture.
/// </summary>
/// <param name="updated">True if the video frame has been updated</param>
/// <returns>A decoded texture</returns>
public IntPtr GetTexture(out bool updated)
<StackLayout>
<ListView x:Name="ItemsListView"
ItemsSource="{Binding Items}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
RefreshCommand="{Binding LoadItemsCommand}"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding IsBusy, Mode=OneWay}"
CachingStrategy="RecycleElement"
ItemSelected="OnItemSelected">
public Item(Media media)
{
Media = media;
Name = media.Meta(MetadataType.Title);
IsDirectory = media.Type == MediaType.Directory;
Type = IsDirectory ? "Directory" : "File";
}
Core.Initialize();
_libVLC = new LibVLC();
foreach (var md in _libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan))
{
var discoverer = new MediaDiscoverer(_libVLC, md.Name);
discoverer.MediaList.ItemAdded += MediaList_ItemAdded;
discoverer.MediaList.ItemDeleted += MediaList_ItemDeleted;
discoverer.Start();
void PanUpdated(object sender, PanUpdatedEventArgs e)
{
switch (e.StatusType)
{
case GestureStatus.Running:
if (ScreenWidth > 0 && ScreenHeight > 0)
{
double range = Math.Max(ScreenWidth, ScreenHeight);
float yaw = (float)(Fov * -e.TotalX / range);// up/down
float pitch = (float)(Fov * -e.TotalY / range);// left/right
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
ScreenWidth = width;
ScreenHeight = height;
}
bool Is360Video => _media.Tracks[0].Data.Video.Projection == VideoProjection.Equirectangular;
internal void OnGesture(PanUpdatedEventArgs e)
{
switch (e.StatusType)
{
case GestureStatus.Running:
if (e.TotalX < 0 && Math.Abs(e.TotalX) > Math.Abs(e.TotalY))
{
var timeDiff = Convert.ToInt64(e.TotalX * 1000);
_finalTime = MediaPlayer.Time + timeDiff;