63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using testdrid.SdlWrapper;
|
|
|
|
namespace SDL2Demo.Screenhacks
|
|
{
|
|
[ScreenHackId(UInt16.MaxValue)]
|
|
internal class MaiWaifu : ScreenHack
|
|
{
|
|
private Texture wallpaperTexture;
|
|
|
|
private FileInfo GetWallpaperFilename()
|
|
{
|
|
if (Directory.Exists("alt-wallpapers"))
|
|
{
|
|
DirectoryInfo altWallpapersFolder = new DirectoryInfo("alt-wallpapers");
|
|
FileInfo[] altWallpapers = altWallpapersFolder.GetFiles("*.png");
|
|
if (altWallpapers.Length > 0)
|
|
{
|
|
return rng.Pick(altWallpapers);
|
|
}
|
|
}
|
|
|
|
DirectoryInfo di = new DirectoryInfo(".");
|
|
FileInfo[] strings = di.GetFiles("*.png");
|
|
return rng.Pick(strings);
|
|
}
|
|
|
|
protected override void Setup()
|
|
{
|
|
FileInfo filename = GetWallpaperFilename();
|
|
|
|
if (filename != null)
|
|
{
|
|
Surface wallpaperSurface = Surface.ImageLoad(filename.FullName);
|
|
wallpaperTexture = Texture.FromSurface(renderer, wallpaperSurface);
|
|
wallpaperSurface.Dispose();
|
|
}
|
|
}
|
|
|
|
public override void MousePressed()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override void Dispose()
|
|
{
|
|
wallpaperTexture?.Dispose();
|
|
}
|
|
|
|
public override void Render()
|
|
{
|
|
if (wallpaperTexture != null)
|
|
{
|
|
renderer.Copy(wallpaperTexture, windowRectangle);
|
|
}
|
|
}
|
|
}
|
|
}
|