Fix reading + saving to db. Added first (test) logo.

This commit is contained in:
Florian Kuepper committed 2012-02-26 14:12:18 +01:00
1 parent bfb5ff3a04
commit 90d059b893
3 files changed
+16 -6

No files matched your search

Binary file not shown.
+7 -5
View File
@@ -28,6 +28,7 @@ namespace Vocaluxe.Base
InitHighscoreDB();
InitCoverDB();
InitCreditsRessourcesDB();
}
#region Highscores
@@ -617,12 +618,12 @@ namespace Vocaluxe.Base
#endregion Cover
#region CreditsRessources
public static bool GetCreditsRessource(string FileName, ref STexture tex, int MaxSize)
public static bool GetCreditsRessource(string FileName, ref STexture tex)
{
bool result = false;
SQLiteConnection connection = new SQLiteConnection();
connection.ConnectionString = "Data Source=" + _CoverFilePath;
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
SQLiteCommand command;
try
{
@@ -686,6 +687,7 @@ namespace Vocaluxe.Base
return result;
}
//If you want to add an image to db, call this method!
private static bool AddImageToCreditsDB(String ImagePath)
{
bool result = false;
@@ -751,11 +753,11 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Images (Path, width, height) " +
"VALUES (@path, " + w.ToString() + ", " + h.ToString() + ")";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = ImagePath;
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath);
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Images WHERE [Path] = @path";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = ImagePath;
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath);
reader = null;
try
{
@@ -873,7 +875,7 @@ namespace Vocaluxe.Base
command.ExecuteNonQuery();
command.CommandText = "CREATE TABLE IF NOT EXISTS ImageData ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
"CoverID INTEGER NOT NULL, Data BLOB NOT NULL);";
"ImageID INTEGER NOT NULL, Data BLOB NOT NULL);";
command.ExecuteNonQuery();
command.Dispose();
+9 -1
View File
@@ -16,6 +16,8 @@ namespace Vocaluxe.Screens
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
private CStatic logo;
public CScreenCredits()
{
Init();
@@ -27,6 +29,11 @@ namespace Vocaluxe.Screens
_ThemeName = "ScreenCredits";
_ScreenVersion = ScreenVersion;
STexture tex = new STexture();
CDataBase.GetCreditsRessource("Logo.png", ref tex);
logo = new CStatic(tex, new SColorF(1,1,1,1), new SRectF(140,140,tex.width, tex.height, -1));
}
public override bool HandleInput(KeyEvent KeyEvent)
@@ -89,7 +96,8 @@ namespace Vocaluxe.Screens
base.Draw();
//Draw white background
CDraw.DrawColor(new SColorF(1, 1, 1, 1), new SRectF(0, 0, 1280, 720, 1));
CDraw.DrawColor(new SColorF(1, 1, 1, 1), new SRectF(0, 0, 1280, 720, 0));
logo.Draw();
return true;
}