Esempio n. 1
0
    public static void TakeScreenshot(Node ctx)
    {
        var image = ctx.GetViewport().GetTexture().GetData();

        image.FlipY();
        var dir = new Godot.Directory();

        dir.Open("user://");
        dir.MakeDir("screenshots");

        image.SavePng($"user://screenshots/{DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss")}.png");
    }
Esempio n. 2
0
 public void Create(bool recursive = true)
 {
     using (var directory = new Directory())
     {
         if (recursive)
         {
             directory.MakeDir(Path).ThrowOnError();
         }
         else
         {
             directory.MakeDirRecursive(Path).ThrowOnError();
         }
     }
 }