Click here to Skip to main content
15,897,151 members
Articles / Multimedia / DirectX

Endogine sprite engine

Rate me:
Please Sign up or sign in to vote.
4.84/5 (53 votes)
17 Jul 200615 min read 718.1K   22.1K   216  
Sprite engine for D3D and GDI+ (with several game examples).
//using System;
//
//namespace Endogine.Scripting
//{
//	/// <summary>
//	/// Summary description for ScripterLua.
//	/// </summary>
//	public class ScripterLua
//	{
//		private string _path;
//		private Hashtable _htScripts;
//
//		static Lua _lua;
//
//		public ScripterLua()
//		{
//			if (_lua==null)
//			{
//				_lua = new Lua();
//				_lua.OpenMathLib();
//				_lua.OpenBaseLib();
//				_lua.OpenStringLib();
//				_lua.OpenIOLib();
//				_lua.OpenLoadLib();
//			}
//
//			//			lua.RegisterFunction("test", this, this.GetType().GetMethod("CalledByLua"));
//
//			this._path = Endogine.AppSettings.Instance.GetNode("Scripting").FirstChild.Name;;
//
//			string sInitScript = PreprocessLuaFile(this._path, "YE.lua");
//			_lua.DoString(sInitScript);
//
//			this._htScripts = new Hashtable();
//		}
//
//		public static string PreprocessLuaFile(string path, string file)
//		{
//			string sScript = Endogine.Files.FileReadWrite.Read(path + file);
//			if (true)
//			{
//				while (true)
//				{
//					System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(sScript, "include \"");
//					if (m.Success)
//					{
//						int nStart = m.Index + m.Length;
//						int nEnd = sScript.IndexOf("\"", nStart);
//						string sIncludeFile = sScript.Substring(nStart, nEnd-nStart);
//
//						string s = Endogine.Files.FileReadWrite.Read(path + sIncludeFile);
//						sScript = sScript.Remove(m.Index, nEnd-m.Index+1);
//						sScript = sScript.Insert(m.Index, s);
//					}
//					else
//						break;
//				}
//			}
//
//			return sScript;
//		}
//
//		public static string PreprocessLuaFileToFile(string path, string file)
//		{
//			string sScript = PreprocessLuaFile(path, file);
//			string outputFile = path + "_m_" + file;
//			Endogine.Files.FileReadWrite.Write(outputFile, sScript);
//			return outputFile;
//		}
//
//		public object Execute(string code)
//		{
//			return _lua.DoString(code);
//		}
//		public object ExecuteFile(string name)
//		{
//			string sFile = (string)this._htScripts[name];
//			return _lua.DoFile(sFile);
//		}
//
//
//		public void Load(string name)
//		{
//			string sFile = PreprocessLuaFileToFile(this._path, name+".lua");
//			this._htScripts.Add(name, sFile);
//		}
//	}
//}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Sweden Sweden
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions