Added proper keyboard handling
This commit is contained in:
1 parent
2fbefe616c
commit
2668b802cb
1 file changed
+77
-76
@@ -125,33 +125,16 @@ namespace Vocaluxe.Screens
|
||||
DeleteProfile();
|
||||
} else if (Buttons[htButtons(ButtonWebcam)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
CWebcam.Start();
|
||||
_Snapshot = CWebcam.GetBitmap();
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = true;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = true;
|
||||
}
|
||||
else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
OnWebcam();
|
||||
} else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
string filename = "snapshot.png";
|
||||
int i = 0;
|
||||
while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + ".png")))
|
||||
{
|
||||
i++;
|
||||
if (!File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png")))
|
||||
{
|
||||
filename += i;
|
||||
}
|
||||
}
|
||||
|
||||
CWebcam.Stop();
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||
}
|
||||
else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
OnSaveSnapshot();
|
||||
} else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
CWebcam.Stop();
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||
OnDiscardSnapshot();
|
||||
} else if (Buttons[htButtons(ButtonTakeSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
OnTakeSnapshot();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -231,61 +214,18 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
CProfiles.SetActive(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection,
|
||||
(EOffOn)SelectSlides[htSelectSlides(SelectSlideActive)].Selection);
|
||||
}
|
||||
else if (Buttons[htButtons(ButtonWebcam)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
} else if (Buttons[htButtons(ButtonWebcam)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
_Snapshot = null;
|
||||
CWebcam.Start();
|
||||
CWebcam.GetFrame(ref _WebcamTexture);
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = true;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = true;
|
||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = true;
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
||||
}
|
||||
else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
OnWebcam();
|
||||
} else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
string filename = "snapshot";
|
||||
int i = 0;
|
||||
while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png")))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
_Snapshot.Save(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"), System.Drawing.Imaging.ImageFormat.Png);
|
||||
CProfiles.LoadAvatars();
|
||||
LoadAvatars();
|
||||
_Snapshot = null;
|
||||
CWebcam.Stop();
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
|
||||
for (int j = 0; j < CProfiles.Avatars.Length; j++)
|
||||
{
|
||||
if (CProfiles.Avatars[j].FileName == (filename + i + ".png"))
|
||||
{
|
||||
CProfiles.SetAvatar(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection, j);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
||||
}
|
||||
else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
OnSaveSnapshot();
|
||||
} else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
CWebcam.Stop();
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
_Snapshot = null;
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
||||
}
|
||||
else if (Buttons[htButtons(ButtonTakeSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
OnDiscardSnapshot();
|
||||
} else if (Buttons[htButtons(ButtonTakeSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||
{
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
||||
_Snapshot = CWebcam.GetBitmap();
|
||||
OnTakeSnapshot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,6 +236,67 @@ namespace Vocaluxe.Screens
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnTakeSnapshot()
|
||||
{
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = true;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = true;
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
||||
_Snapshot = CWebcam.GetBitmap();
|
||||
}
|
||||
|
||||
private void OnDiscardSnapshot()
|
||||
{
|
||||
CWebcam.Stop();
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
_Snapshot = null;
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
||||
}
|
||||
|
||||
private void OnSaveSnapshot()
|
||||
{
|
||||
string filename = "snapshot";
|
||||
int i = 0;
|
||||
while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png")))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
_Snapshot.Save(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"), System.Drawing.Imaging.ImageFormat.Png);
|
||||
CProfiles.LoadAvatars();
|
||||
LoadAvatars();
|
||||
_Snapshot = null;
|
||||
CWebcam.Stop();
|
||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||
|
||||
for (int j = 0; j < CProfiles.Avatars.Length; j++)
|
||||
{
|
||||
if (CProfiles.Avatars[j].FileName == (filename + i + ".png"))
|
||||
{
|
||||
CProfiles.SetAvatar(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection, j);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
||||
}
|
||||
|
||||
private void OnWebcam()
|
||||
{
|
||||
_Snapshot = null;
|
||||
CWebcam.Start();
|
||||
CWebcam.GetFrame(ref _WebcamTexture);
|
||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = true;
|
||||
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
if (SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection > -1)
|
||||
|
||||
Reference in new issue
Block a user