[gbrainy] Load images from assemblies



commit 0e959d651ca165a6ad488e387ba5eb158bd312d9
Author: Jordi Mas <jmas softcatala org>
Date:   Sat Nov 21 11:38:28 2009 +0100

    Load images from assemblies

 data/Makefile.am                     |   10 ----------
 src/Core/Libraries/CairoContextEx.cs |    2 +-
 src/Core/Makefile.am                 |    9 ++++++++-
 src/Core/Views/WelcomeView.cs        |    8 ++++----
 src/Games/Makefile.am                |    5 ++++-
 5 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index e5d0aa5..3ec2543 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -46,11 +46,6 @@ install-data-local:
 	@-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/48x48/apps
 	$(INSTALL_DATA) $(srcdir)/app-graphics/gbrainy.png $(DESTDIR)$(hicolordir)/48x48/apps/gbrainy.png
 	@-$(mkinstalldirs) $(DESTDIR)$(images)
-	$(INSTALL_DATA) $(srcdir)/app-graphics/math-games.svg $(DESTDIR)$(images)/math-games.svg
-	$(INSTALL_DATA) $(srcdir)/app-graphics/logic-games.svg $(DESTDIR)$(images)/logic-games.svg
-	$(INSTALL_DATA) $(srcdir)/app-graphics/memory-games.svg $(DESTDIR)$(images)/memory-games.svg
-	$(INSTALL_DATA) $(srcdir)/app-graphics/verbal-games.svg $(DESTDIR)$(images)/verbal-games.svg
-	$(INSTALL_DATA) $(srcdir)/app-graphics/background.svg $(DESTDIR)$(images)/background.svg
 	$(INSTALL_DATA) $(srcdir)/verbal_analogies.xml $(DESTDIR)$(images)/verbal_analogies.xml
 
 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
@@ -65,11 +60,6 @@ install-data-hook:
 	fi
 
 uninstall-hook:
-	rm -f $(DESTDIR)$(images)/math-games.svg
-	rm -f $(DESTDIR)$(images)/logic-games.svg
-	rm -f $(DESTDIR)$(images)/memory-games.svg
-	rm -f $(DESTDIR)$(images)/verbal-games.svg
-	rm -f $(DESTDIR)$(images)/background.svg
 	rm -f $(DESTDIR)$(images)/verbal_analogies.xml
 	rm -f $(DESTDIR)$(hicolordir)/48x48/apps/gbrainy.png
 	rm -f $(DESTDIR)$(hicolordir)/32x32/apps/gbrainy.png
diff --git a/src/Core/Libraries/CairoContextEx.cs b/src/Core/Libraries/CairoContextEx.cs
index 5cc8708..cd69dc5 100644
--- a/src/Core/Libraries/CairoContextEx.cs
+++ b/src/Core/Libraries/CairoContextEx.cs
@@ -385,7 +385,7 @@ namespace gbrainy.Core.Libraries
 		{
 			try {
 				if (image == null)
-					image = new SVGImage (Defines.DATA_DIR + "background.svg");
+					image = new SVGImage (System.Reflection.Assembly.GetCallingAssembly (), "background.svg");
 
 				Save ();
 				Rectangle (0, 0, 1, 1);
diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am
index 23d3a3d..e7e42ff 100644
--- a/src/Core/Makefile.am
+++ b/src/Core/Makefile.am
@@ -30,7 +30,14 @@ CSFILES =  \
 		Libraries/CairoContextEx.cs	\
 		Libraries/SVGImage.cs
 
-RES = 
+RES = \
+$(top_srcdir)/data/app-graphics/background.svg  	\
+$(top_srcdir)/data/app-graphics/logic-games.svg		\
+$(top_srcdir)/data/app-graphics/math-games.svg		\
+$(top_srcdir)/data/app-graphics/memory-games.svg	\	
+$(top_srcdir)/data/app-graphics/verbal-games.svg	
+
+
 REFS =  \
 	-r:System \
 	-r:Mono.Cairo.dll		\
diff --git a/src/Core/Views/WelcomeView.cs b/src/Core/Views/WelcomeView.cs
index ea1f7f2..6f8741f 100644
--- a/src/Core/Views/WelcomeView.cs
+++ b/src/Core/Views/WelcomeView.cs
@@ -54,25 +54,25 @@ namespace gbrainy.Core.Views
 			gr.DrawStringWithWrapping (0.05, y + 0.07, Catalog.GetString ("gbrainy is a brain teaser game and trainer to have fun and to keep your brain trained. It includes:"));
 
 			y = 0.22;
-			gr.DrawImageFromFile (Defines.DATA_DIR + "logic-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
+			gr.DrawImageFromAssembly ("logic-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
 			gr.DrawStringWithWrapping (rtl ? 0.05 : 0.23, y + 0.01, 
 				Catalog.GetString ("Logic puzzles. Challenge your reasoning and thinking skills."), 
 				rtl ? 0.65 : -1);
 
 			y += space;
-			gr.DrawImageFromFile (Defines.DATA_DIR + "math-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
+			gr.DrawImageFromAssembly ("math-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
 			gr.DrawStringWithWrapping (rtl ? 0.05 : 0.23, y + 0.01, 
 				Catalog.GetString ("Mental calculation. Arithmetical operations that test your mental calculation abilities."),
 				rtl ? 0.65 : -1);
 
 			y += space;
-			gr.DrawImageFromFile (Defines.DATA_DIR + "memory-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
+			gr.DrawImageFromAssembly ("memory-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
 			gr.DrawStringWithWrapping (rtl ? 0.05 : 0.23, y + 0.01, 
 				Catalog.GetString ("Memory trainers. To prove your short term memory."),
 				rtl ? 0.65 : -1);
 
 			y += space;
-			gr.DrawImageFromFile (Defines.DATA_DIR + "verbal-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
+			gr.DrawImageFromAssembly ("verbal-games.svg", rtl ? 0.75 : 0.05, y, image_size, image_size);
 			gr.DrawStringWithWrapping (rtl ? 0.05 : 0.23, y + 0.01, 
 				Catalog.GetString ("Verbal analogies. Challenge your verbal aptitude."),
 				rtl ? 0.65 : -1);
diff --git a/src/Games/Makefile.am b/src/Games/Makefile.am
index d2ff965..92d3752 100644
--- a/src/Games/Makefile.am
+++ b/src/Games/Makefile.am
@@ -66,7 +66,10 @@ CSFILES =  \
 		Calculation/CalculationRatio.cs			\
 		Calculation/CalculationTwoNumbers.cs
 
-RES = 
+RES = \
+$(top_srcdir)/data/game-graphics/present.svg  \
+$(top_srcdir)/data/game-graphics/handshake.svg
+
 REFS =  \
 	-r:System \
 	-r:Mono.Cairo.dll		\



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]