Source

SharpHammer / UnitTest / Program.cs

Full commit
using System;
using SharpHammer;

namespace UnitTest
{
	class Program
	{
		static int prev_x = 0;
		static int prev_y = 0;

		static void updateCamera()
		{
			int mx = 0, my = 0;
			uint mousekeys = 0;
			bool rm = engine.input_get_mouse(ref mx, ref my, ref mousekeys);
			if (engine.app_isactive() && rm) {
				if (prev_x != 0 && prev_y != 0 &&
				(((mousekeys) & ((uint)input_key.INPUT_KEY_LEFT)) != 0) &&
				(mx >= 0 && mx < engine.app_get_wndwidth()) &&
				(my >= 0 && my < engine.app_get_wndheight())) {
					float dx = (float)(mx - prev_x);
					float dy = (float)(my - prev_y);
					if (Math.Abs(dx) > .001f) {

					}
				}

			}
		}

		static void onUpdate()
		{
			engine.input_update();

		}

		private static void Main(string[] args)
		{
			core.core_init(true);
			core.log_outputconsole(true);
			var param = engine.app_defaultconfig();
			engine.app_init("dark-hammer:test", param, IntPtr.Zero);
			engine.eng_init(param);
			engine.app_set_updatefunc(onUpdate);
			//	app_set_keypressfunc(keypress_callback);
			//	app_set_activefunc(activate_callback);
			//	gfx_set_debug_renderfunc(debug_view_callback);
			engine.app_show_window(null);
			engine.app_update();

			if (param != IntPtr.Zero)
				engine.app_unload_config(param);

			engine.eng_release();
			engine.app_release();

			core.core_release(true);
		}

	}
}