samples: Added some guiAndGfx and resources
authorJerome St-Louis <jerome@ecere.com>
Tue, 17 May 2011 03:35:57 +0000 (23:35 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 17 May 2011 03:35:57 +0000 (23:35 -0400)
20 files changed:
samples/audio/Piano/chord.wav [new file with mode: 0644]
samples/audio/Piano/ding.wav [new file with mode: 0644]
samples/games/scrabble/scrabble.epj
samples/games/tetris/tetris.epj
samples/guiAndGfx/BitmapAudioKB/Bitmap/bitmap.ec [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/Bitmap/bitmap.epj [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/Bitmaps, Keyboard and Sound.pptx [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/KBController/controller.ec [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/KBController/controller.epj [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/KBOnKeyHit/OnKeyHit.ec [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/KBOnKeyHit/OnKeyHit.epj [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/KBState/KBState.ec [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/KBState/KBState.epj [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/Objects/objects.ec [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/Objects/objects.epj [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/res/archer.png [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/res/castle.png [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/res/dragon.png [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/res/mage.png [new file with mode: 0644]
samples/guiAndGfx/BitmapAudioKB/res/peasant.png [new file with mode: 0644]

diff --git a/samples/audio/Piano/chord.wav b/samples/audio/Piano/chord.wav
new file mode 100644 (file)
index 0000000..7d01446
Binary files /dev/null and b/samples/audio/Piano/chord.wav differ
diff --git a/samples/audio/Piano/ding.wav b/samples/audio/Piano/ding.wav
new file mode 100644 (file)
index 0000000..122f301
Binary files /dev/null and b/samples/audio/Piano/ding.wav differ
index cdfbae6..8348c21 100644 (file)
@@ -46,7 +46,7 @@
    ],
    "ResourcesPath" : "",
    "Resources" : [
-      "dico.txt",
-      "english.txt"
+      "res/dico.txt",
+      "res/english.txt"
    ]
 }
\ No newline at end of file
index ae72139..125fbd1 100644 (file)
@@ -1,79 +1,56 @@
-
-ECERE Project File
-
-Version 0.1a
-
-Target "tetris"
-
-   Configurations
-
-    + Debug
-
-         Compiler Options
-
-            Intermediate Directory = debug
-            Debug = True
-            Optimize = None
-            Profile = False
-            MemoryGuard = False
-            AllWarnings = True
-            Strict Name Spaces = False
-
-         Linker Options
-
-            Target Name = tetris
-            Target Type = Executable
-            Target Directory = debug
-            Console = False
-
-            Libraries = ecere
-
-    + Release
-
-         Compiler Options
-
-            Intermediate Directory = release
-            Debug = False
-            Optimize = Speed
-            Profile = False
-            MemoryGuard = False
-            AllWarnings = True
-            Strict Name Spaces = False
-
-         Linker Options
-
-            Target Name = tetris
-            Target Type = Executable
-            Target Directory = release
-            Console = False
-
-            Libraries = ecere
-
-    + memguard
-
-         Compiler Options
-
-            Intermediate Directory = memguard
-            Debug = True
-            Optimize = None
-            Profile = False
-            MemoryGuard = True
-            AllWarnings = True
-            Strict Name Spaces = False
-
-         Linker Options
-
-            Target Name = tetris
-            Target Type = Executable
-            Target Directory = memguard
-            Console = False
-
-            Libraries = memguard
-
-   Files
-
-    - tetris.ec
-
-   Resources
-
-    = data/tetris.bmp
+{
+   "Version" : 0.2,
+   "ModuleName" : "tetris",
+   "Options" : {
+      "Warnings" : "All",
+      "Profile" : false,
+      "StrictNameSpaces" : false,
+      "TargetType" : "Executable",
+      "Libraries" : [
+         "ecere"
+      ],
+      "Console" : false
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "MemoryGuard" : false,
+            "Optimization" : "None",
+            "TargetFileName" : "tetris",
+            "TargetDirectory" : "debug",
+            "ObjectsDirectory" : "debug"
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "MemoryGuard" : false,
+            "Optimization" : "Speed",
+            "TargetFileName" : "tetris",
+            "TargetDirectory" : "release",
+            "ObjectsDirectory" : "release"
+         }
+      },
+      {
+         "Name" : "memguard",
+         "Options" : {
+            "Debug" : true,
+            "MemoryGuard" : true,
+            "Optimization" : "None",
+            "TargetFileName" : "tetris",
+            "TargetDirectory" : "memguard",
+            "ObjectsDirectory" : "memguard"
+         }
+      }
+   ],
+   "Files" : [
+      "tetris.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+      "res/tetris.bmp"
+   ]
+}
\ No newline at end of file
diff --git a/samples/guiAndGfx/BitmapAudioKB/Bitmap/bitmap.ec b/samples/guiAndGfx/BitmapAudioKB/Bitmap/bitmap.ec
new file mode 100644 (file)
index 0000000..8d21716
--- /dev/null
@@ -0,0 +1,24 @@
+import "ecere"
+
+class MainWindow : Window
+{
+   text = "Bitmap Demo";
+   background = black;
+   borderStyle = sizable;
+   hasMaximize = true;
+   hasMinimize = true;
+   hasClose = true;
+   size = { 576, 432 };
+
+   BitmapResource castleGfx { ":castle.png", window = this };
+
+   void OnRedraw(Surface surface)
+   {
+      Bitmap bitmap = castleGfx.bitmap;
+      
+      if(bitmap)
+         surface.Blit(bitmap, 100, 100, 0,0, bitmap.width, bitmap.height);
+   }
+}
+
+MainWindow mainWindow {};
diff --git a/samples/guiAndGfx/BitmapAudioKB/Bitmap/bitmap.epj b/samples/guiAndGfx/BitmapAudioKB/Bitmap/bitmap.epj
new file mode 100644 (file)
index 0000000..8ae46ea
--- /dev/null
@@ -0,0 +1,38 @@
+{
+   "Version" : 0.2,
+   "ModuleName" : "BitmapAudioKB",
+   "Options" : {
+      "Warnings" : "All",
+      "TargetType" : "Executable",
+      "TargetFileName" : "bitmap",
+      "Libraries" : [
+         "ecere"
+      ]
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "Optimization" : "None",
+            "PreprocessorDefinitions" : [
+               "_DEBUG"
+            ]
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "Optimization" : "Speed"
+         }
+      }
+   ],
+   "Files" : [
+      "bitmap.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+      "../res/castle.png"
+   ]
+}
\ No newline at end of file
diff --git a/samples/guiAndGfx/BitmapAudioKB/Bitmaps, Keyboard and Sound.pptx b/samples/guiAndGfx/BitmapAudioKB/Bitmaps, Keyboard and Sound.pptx
new file mode 100644 (file)
index 0000000..06b3647
Binary files /dev/null and b/samples/guiAndGfx/BitmapAudioKB/Bitmaps, Keyboard and Sound.pptx differ
diff --git a/samples/guiAndGfx/BitmapAudioKB/KBController/controller.ec b/samples/guiAndGfx/BitmapAudioKB/KBController/controller.ec
new file mode 100644 (file)
index 0000000..0a1af5c
--- /dev/null
@@ -0,0 +1,128 @@
+import "ecere"
+
+BitmapResource peasantGfx { ":peasant.png" };
+BitmapResource dragonGfx { ":dragon.png" };
+BitmapResource mageGfx { ":mage.png" };
+BitmapResource archerGfx { ":archer.png" };
+BitmapResource castleGfx { ":castle.png" };
+
+Array<BitmapResource> gfxResources { [ peasantGfx, dragonGfx, mageGfx, archerGfx, castleGfx ] };
+
+class WorldObject
+{
+   bool selectable;
+   BitmapResource res;
+
+   void Render(Surface surface)
+   {
+      Bitmap bmp = res ? res.bitmap : null;
+      if(bmp)
+      {
+         surface.Blit(bmp, x, y, 0,0, bmp.width, bmp.height);
+         if(this == selected)
+         {
+            surface.foreground = lime;
+            surface.Rectangle(x-1, y-1, x + bmp.width, y + bmp.height);
+            surface.foreground = white;
+            surface.Rectangle(x-2, y-2, x + bmp.width+1, y + bmp.height+1);
+         }
+      }      
+   }
+
+public:
+   int x, y;
+}
+
+class Peasant : WorldObject { res = peasantGfx; selectable = true; }
+class Dragon : WorldObject { res = dragonGfx; }
+class Mage : WorldObject { res = mageGfx; selectable = true; }
+class Archer : WorldObject { res = archerGfx; selectable = true; }
+class Castle : WorldObject { res = castleGfx; }
+Array<WorldObject> objects
+{ [
+   Castle { 180, 150 },
+   Mage { 50, 50 },
+   Archer { 150, 250 },
+   Peasant { 380, 290 },
+   Peasant { 120, 150 },
+   Dragon { 320, 50 }
+] };
+
+WorldObject selected;   
+
+class WorldObjectController : WindowController<WorldObject>
+{
+   bool OnKeyHit(WorldObjectController controller, Key key, unichar ch)
+   {
+      switch(key)
+      {
+         case tab:
+         {
+            Iterator<WorldObject> it { objects };
+            it.Find(selected);
+            do
+            {
+               if(!it.Next())
+                  it.Next();
+               selected = it.data;
+            } while(!selected.selectable);
+            controller.controlled = selected;
+            break;
+         }
+         case left: x -= 5; break;
+         case right: x += 5; break;
+         case up: y -= 5; break;
+         case down: y += 5; break;
+      }
+      controller.window.Update(null);
+      return true;
+   }
+}
+
+class MainWindow : Window
+{
+   text = "Keyboard Input Using Controllers";
+   background = black;
+   borderStyle = sizable;
+   hasMaximize = true;
+   hasMinimize = true;
+   hasClose = true;
+   size = { 576, 432 };
+
+   controller = WorldObjectController { this };
+
+   bool OnCreate()
+   {
+      selected = objects[1];
+      ((WorldObjectController)controller).controlled = selected;
+      return true;
+   }
+
+   bool OnLoadGraphics()
+   {
+      for(r : gfxResources)
+         AddResource(r);
+      return true;
+   }
+
+   void OnUnloadGraphics()
+   {
+      for(r : gfxResources)
+         RemoveResource(r);
+   }
+
+   void OnDestroy()
+   {
+      controller = null;
+      objects.Free();
+   }
+
+   void OnRedraw(Surface surface)
+   {
+      for(o : objects)
+         o.Render(surface);
+   }
+}
+
+MainWindow mainWindow {};
diff --git a/samples/guiAndGfx/BitmapAudioKB/KBController/controller.epj b/samples/guiAndGfx/BitmapAudioKB/KBController/controller.epj
new file mode 100644 (file)
index 0000000..235e226
--- /dev/null
@@ -0,0 +1,43 @@
+{
+   "Version" : 0.2,
+   "ModuleName" : "BitmapAudioKB",
+   "Options" : {
+      "Warnings" : "All",
+      "TargetType" : "Executable",
+      "TargetFileName" : "controller",
+      "Libraries" : [
+         "ecere"
+      ],
+      "Console" : true
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "Optimization" : "None",
+            "PreprocessorDefinitions" : [
+               "_DEBUG"
+            ]
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "Optimization" : "Speed"
+         }
+      }
+   ],
+   "Files" : [
+      "controller.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+      "../res/archer.png",
+      "../res/castle.png",
+      "../res/dragon.png",
+      "../res/mage.png",
+      "../res/peasant.png"
+   ]
+}
\ No newline at end of file
diff --git a/samples/guiAndGfx/BitmapAudioKB/KBOnKeyHit/OnKeyHit.ec b/samples/guiAndGfx/BitmapAudioKB/KBOnKeyHit/OnKeyHit.ec
new file mode 100644 (file)
index 0000000..1ea2014
--- /dev/null
@@ -0,0 +1,123 @@
+import "ecere"
+
+BitmapResource peasantGfx { ":peasant.png" };
+BitmapResource dragonGfx { ":dragon.png" };
+BitmapResource mageGfx { ":mage.png" };
+BitmapResource archerGfx { ":archer.png" };
+BitmapResource castleGfx { ":castle.png" };
+
+Array<BitmapResource> gfxResources { [ peasantGfx, dragonGfx, mageGfx, archerGfx, castleGfx ] };
+
+class WorldObject
+{
+   bool selectable;
+   BitmapResource res;
+
+   void Render(Surface surface)
+   {
+      Bitmap bmp = res ? res.bitmap : null;
+      if(bmp)
+      {
+         surface.Blit(bmp, x, y, 0,0, bmp.width, bmp.height);
+         if(this == selected)
+         {
+            surface.foreground = lime;
+            surface.Rectangle(x-1, y-1, x + bmp.width, y + bmp.height);
+            surface.foreground = white;
+            surface.Rectangle(x-2, y-2, x + bmp.width+1, y + bmp.height+1);
+         }
+      }      
+   }
+
+public:
+   int x, y;
+}
+
+class Peasant : WorldObject { res = peasantGfx; selectable = true; }
+class Dragon : WorldObject { res = dragonGfx; }
+class Mage : WorldObject { res = mageGfx; selectable = true; }
+class Archer : WorldObject { res = archerGfx; selectable = true; }
+class Castle : WorldObject { res = castleGfx; }
+
+Array<WorldObject> objects
+{ [
+   Castle { 180, 150 },
+   Mage { 50, 50 },
+   Archer { 150, 250 },
+   Peasant { 380, 290 },
+   Peasant { 120, 150 },
+   Dragon { 320, 50 }
+] };
+
+WorldObject selected;   
+
+class MainWindow : Window
+{
+   text = "Moving objects around with the keyboard";
+   background = black;
+   borderStyle = sizable;
+   hasMaximize = true;
+   hasMinimize = true;
+   hasClose = true;
+   size = { 576, 432 };
+
+   bool OnCreate()
+   {
+      selected = objects[1];
+      return true;
+   }
+
+   void OnDestroy()
+   {
+      objects.Free();
+   }
+
+   bool OnLoadGraphics()
+   {
+      for(r : gfxResources)
+         AddResource(r);
+      return true;
+   }
+
+   void OnUnloadGraphics()
+   {
+      for(r : gfxResources)
+         RemoveResource(r);
+   }
+
+   void OnRedraw(Surface surface)
+   {
+      for(o : objects)
+         o.Render(surface);
+   }
+
+   bool OnKeyHit(Key key, unichar ch)
+   {
+      if(selected)
+      {
+         switch(key)
+         {
+            case left: selected.x -= 5; break;
+            case right: selected.x += 5; break;
+            case up: selected.y -= 5; break;
+            case down: selected.y += 5; break;
+            case tab:
+            {
+               Iterator<WorldObject> it { objects };
+               it.Find(selected);
+               do
+               {
+                  if(!it.Next())
+                     it.Next();
+                  selected = it.data;
+               } while(!selected.selectable);
+               break;
+            }
+         }
+         Update(null);
+      }
+      return true;
+   }
+}
+
+MainWindow mainWindow {};
diff --git a/samples/guiAndGfx/BitmapAudioKB/KBOnKeyHit/OnKeyHit.epj b/samples/guiAndGfx/BitmapAudioKB/KBOnKeyHit/OnKeyHit.epj
new file mode 100644 (file)
index 0000000..cc10828
--- /dev/null
@@ -0,0 +1,43 @@
+{
+   "Version" : 0.2,
+   "ModuleName" : "BitmapAudioKB",
+   "Options" : {
+      "Warnings" : "All",
+      "TargetType" : "Executable",
+      "TargetFileName" : "OnKeyHit",
+      "Libraries" : [
+         "ecere"
+      ],
+      "Console" : true
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "Optimization" : "None",
+            "PreprocessorDefinitions" : [
+               "_DEBUG"
+            ]
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "Optimization" : "Speed"
+         }
+      }
+   ],
+   "Files" : [
+      "OnKeyHit.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+      "../res/archer.png",
+      "../res/castle.png",
+      "../res/dragon.png",
+      "../res/mage.png",
+      "../res/peasant.png"
+   ]
+}
\ No newline at end of file
diff --git a/samples/guiAndGfx/BitmapAudioKB/KBState/KBState.ec b/samples/guiAndGfx/BitmapAudioKB/KBState/KBState.ec
new file mode 100644 (file)
index 0000000..56d5937
--- /dev/null
@@ -0,0 +1,147 @@
+import "ecere"
+
+BitmapResource peasantGfx { ":peasant.png" };
+BitmapResource dragonGfx { ":dragon.png" };
+BitmapResource mageGfx { ":mage.png" };
+BitmapResource archerGfx { ":archer.png" };
+BitmapResource castleGfx { ":castle.png" };
+
+Array<BitmapResource> gfxResources { [ peasantGfx, dragonGfx, mageGfx, archerGfx, castleGfx ] };
+
+class WorldObject
+{
+   bool selectable;
+   BitmapResource res;
+
+   void Render(Surface surface)
+   {
+      Bitmap bmp = res ? res.bitmap : null;
+      if(bmp)
+      {
+         surface.Blit(bmp, x, y, 0,0, bmp.width, bmp.height);
+         if(this == selected)
+         {
+            surface.foreground = lime;
+            surface.Rectangle(x-1, y-1, x + bmp.width, y + bmp.height);
+            surface.foreground = white;
+            surface.Rectangle(x-2, y-2, x + bmp.width+1, y + bmp.height+1);
+         }
+      }      
+   }
+
+public:
+   int x, y;
+}
+
+class Peasant : WorldObject { res = peasantGfx; selectable = true; }
+class Dragon : WorldObject { res = dragonGfx; }
+class Mage : WorldObject { res = mageGfx; selectable = true; }
+class Archer : WorldObject { res = archerGfx; selectable = true; }
+class Castle : WorldObject { res = castleGfx; }
+Array<WorldObject> objects
+{ [
+   Castle { 180, 150 },
+   Mage { 50, 50 },
+   Archer { 150, 250 },
+   Peasant { 380, 290 },
+   Peasant { 120, 150 },
+   Dragon { 320, 50 }
+] };
+
+WorldObject selected;   
+
+class MainWindow : Window
+{
+   text = "State based keyboard input";
+   background = black;
+   borderStyle = sizable;
+   hasMaximize = true;
+   hasMinimize = true;
+   hasClose = true;
+   size = { 576, 432 };
+
+   bool OnCreate()
+   {
+      selected = objects[1];
+      return true;
+   }
+
+   bool OnLoadGraphics()
+   {
+      for(r : gfxResources)
+         AddResource(r);
+      return true;
+   }
+
+   void OnUnloadGraphics()
+   {
+      for(r : gfxResources)
+         RemoveResource(r);
+   }
+
+   void OnDestroy()
+   {
+      objects.Free();
+   }
+
+   void OnRedraw(Surface surface)
+   {
+      for(o : objects)
+         o.Render(surface);
+   }
+
+   bool OnKeyHit(Key key, unichar ch)
+   {
+      if(selected)
+      {
+         switch(key)
+         {
+            case tab:
+            {
+               Iterator<WorldObject> it { objects };
+               it.Find(selected);
+               do
+               {
+                  if(!it.Next())
+                     it.Next();
+                  selected = it.data;
+               } while(!selected.selectable);
+               Update(null);
+               break;
+            }
+         }
+         Update(null);
+      }
+      return true;
+   }
+}
+
+define moveSpeed = 100.0; // 100 pixels per seconds
+
+class SampleApp : GuiApplication
+{
+   timerResolution = 60;
+   bool Cycle(bool idle)
+   {
+      bool moved = false;
+      static Time lastTime;
+      Time time = GetTime(), diffTime = time - lastTime;
+      if(diffTime >= 1 / moveSpeed)
+      {
+         if(selected)
+         {
+            if(GetKeyState(left))  { selected.x -= diffTime * 100 - 0.5; moved = true; }
+            if(GetKeyState(right)) { selected.x += diffTime * 100;       moved = true; }
+            if(GetKeyState(up))    { selected.y -= diffTime * 100 - 0.5; moved = true; }
+            if(GetKeyState(down))  { selected.y += diffTime * 100;       moved = true; }
+            if(moved)
+               mainWindow.Update(null);
+         }
+         lastTime = time;
+      }
+      return !moved;
+   }
+}
+
+MainWindow mainWindow {};
diff --git a/samples/guiAndGfx/BitmapAudioKB/KBState/KBState.epj b/samples/guiAndGfx/BitmapAudioKB/KBState/KBState.epj
new file mode 100644 (file)
index 0000000..c3da432
--- /dev/null
@@ -0,0 +1,43 @@
+{
+   "Version" : 0.2,
+   "ModuleName" : "BitmapAudioKB",
+   "Options" : {
+      "Warnings" : "All",
+      "TargetType" : "Executable",
+      "TargetFileName" : "KBState",
+      "Libraries" : [
+         "ecere"
+      ],
+      "Console" : true
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "Optimization" : "None",
+            "PreprocessorDefinitions" : [
+               "_DEBUG"
+            ]
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "Optimization" : "Speed"
+         }
+      }
+   ],
+   "Files" : [
+      "KBState.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+      "../res/archer.png",
+      "../res/castle.png",
+      "../res/dragon.png",
+      "../res/mage.png",
+      "../res/peasant.png"
+   ]
+}
\ No newline at end of file
diff --git a/samples/guiAndGfx/BitmapAudioKB/Objects/objects.ec b/samples/guiAndGfx/BitmapAudioKB/Objects/objects.ec
new file mode 100644 (file)
index 0000000..30cc782
--- /dev/null
@@ -0,0 +1,77 @@
+import "ecere"
+
+BitmapResource peasantGfx { ":peasant.png" };
+BitmapResource dragonGfx { ":dragon.png" };
+BitmapResource mageGfx { ":mage.png" };
+BitmapResource archerGfx { ":archer.png" };
+BitmapResource castleGfx { ":castle.png" };
+
+Array<BitmapResource> gfxResources { [ peasantGfx, dragonGfx, mageGfx, archerGfx, castleGfx ] };
+
+class WorldObject
+{
+   BitmapResource res;
+
+   void Render(Surface surface)
+   {
+      Bitmap bmp = res ? res.bitmap : null;
+      if(bmp)
+         surface.Blit(bmp, x, y, 0,0, bmp.width, bmp.height);
+   }
+
+public:
+   int x, y;
+}
+
+class Peasant : WorldObject { res = peasantGfx; }
+class Dragon : WorldObject { res = dragonGfx; }
+class Mage : WorldObject { res = mageGfx; }
+class Archer : WorldObject { res = archerGfx; }
+class Castle : WorldObject { res = castleGfx; }
+Array<WorldObject> objects
+{ [
+   Castle { 180, 150 },
+   Mage { 50, 50 },
+   Archer { 150, 250 },
+   Peasant { 380, 290 },
+   Peasant { 120, 150 },
+   Dragon { 320, 50 }
+] };
+
+class MainWindow : Window
+{
+   text = "A World of Objects";
+   background = black;
+   borderStyle = sizable;
+   hasMaximize = true;
+   hasMinimize = true;
+   hasClose = true;
+   size = { 576, 432 };
+
+   bool OnLoadGraphics()
+   {
+      for(r : gfxResources)
+         AddResource(r);
+      return true;
+   }
+
+   void OnUnloadGraphics()
+   {
+      for(r : gfxResources)
+         RemoveResource(r);
+   }
+
+   void OnDestroy()
+   {
+      objects.Free();
+   }
+
+   void OnRedraw(Surface surface)
+   {
+      for(o : objects)
+         o.Render(surface);
+   }
+}
+
+MainWindow mainWindow {};
diff --git a/samples/guiAndGfx/BitmapAudioKB/Objects/objects.epj b/samples/guiAndGfx/BitmapAudioKB/Objects/objects.epj
new file mode 100644 (file)
index 0000000..fcbaf4e
--- /dev/null
@@ -0,0 +1,43 @@
+{
+   "Version" : 0.2,
+   "ModuleName" : "BitmapAudioKB",
+   "Options" : {
+      "Warnings" : "All",
+      "TargetType" : "Executable",
+      "TargetFileName" : "objects",
+      "Libraries" : [
+         "ecere"
+      ],
+      "Console" : true
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "Optimization" : "None",
+            "PreprocessorDefinitions" : [
+               "_DEBUG"
+            ]
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "Optimization" : "Speed"
+         }
+      }
+   ],
+   "Files" : [
+      "objects.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+      "../res/archer.png",
+      "../res/castle.png",
+      "../res/dragon.png",
+      "../res/mage.png",
+      "../res/peasant.png"
+   ]
+}
\ No newline at end of file
diff --git a/samples/guiAndGfx/BitmapAudioKB/res/archer.png b/samples/guiAndGfx/BitmapAudioKB/res/archer.png
new file mode 100644 (file)
index 0000000..ed9ad38
Binary files /dev/null and b/samples/guiAndGfx/BitmapAudioKB/res/archer.png differ
diff --git a/samples/guiAndGfx/BitmapAudioKB/res/castle.png b/samples/guiAndGfx/BitmapAudioKB/res/castle.png
new file mode 100644 (file)
index 0000000..5601b4d
Binary files /dev/null and b/samples/guiAndGfx/BitmapAudioKB/res/castle.png differ
diff --git a/samples/guiAndGfx/BitmapAudioKB/res/dragon.png b/samples/guiAndGfx/BitmapAudioKB/res/dragon.png
new file mode 100644 (file)
index 0000000..73f63f5
Binary files /dev/null and b/samples/guiAndGfx/BitmapAudioKB/res/dragon.png differ
diff --git a/samples/guiAndGfx/BitmapAudioKB/res/mage.png b/samples/guiAndGfx/BitmapAudioKB/res/mage.png
new file mode 100644 (file)
index 0000000..9fd81fb
Binary files /dev/null and b/samples/guiAndGfx/BitmapAudioKB/res/mage.png differ
diff --git a/samples/guiAndGfx/BitmapAudioKB/res/peasant.png b/samples/guiAndGfx/BitmapAudioKB/res/peasant.png
new file mode 100644 (file)
index 0000000..b3575a4
Binary files /dev/null and b/samples/guiAndGfx/BitmapAudioKB/res/peasant.png differ