Jump to content

  • Log In with Google      Sign In   
  • Create Account

consti

Member Since 12 Sep 2007
Offline Last Active Jan 25 2014 06:11 PM

Posts I've Made

In Topic: Understanding Tiled TMX gids.

15 April 2013 - 01:00 PM

Thanks a lot, this snippet helped me to clarify things a bit. Clever approach to iterate through all of the tilesets.


In Topic: xna dead. now what?

15 April 2013 - 09:33 AM

Here is my favourites (random order):

  • SharpDX: If you want DirectX support currently better for Windows PC, perhaps in the future also for tablets/mobile. There was an ongoing vote to convice Microsoft to enable some functionality that could allow developers to support mobile/tablet devices running Windows 8, but who knows what happened.
  • OpenTK: Very good for cross platform (Windows/Mac/Linux), unfortunately support is halted so you must use the repo of Andy Korth at github in order to get the latest version. Also if you are interested in MonoTouch and MonoDroid chances are that you can reuse most of your code.
  • Pencil.Gaming: An evolution of OpenTK, more clean and practial. It looks like a polished version of OpenTK that is tied to GLFW3 instead for Window management.
  • Unity: You will have to use it to believe. For me personally, let me do other creative things in game rather than system development. It's a matter of where exactly is your interest.

In Topic: [SlimDX] How to draw lines

08 February 2011 - 04:45 PM

Thanks again man, I finally got some random lines with this code.

using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using SlimDX;
using SlimDX.Direct3D9;

namespace SlimDXGUI
{
	class Program
	{
		public struct LineVertex
		{
				public Vector3 Position { get; set; }
				public int Color { get; set; }
		}

		public class Form1 : Form
		{
			Direct3D d3d;
			Device device;
			LineVertex[] lineData;
			VertexBuffer vertexBuffer;
			System.Timers.Timer timer = new System.Timers.Timer();
			Random rnd = new Random(DateTime.Now.Millisecond);
			
			protected override void OnLoad(EventArgs e)
			{
				d3d = new Direct3D();

				PresentParameters pp = new PresentParameters();
				pp.SwapEffect = SwapEffect.Discard;
				pp.DeviceWindowHandle = Handle;
				pp.Windowed = true;
				pp.BackBufferWidth = Width;
				pp.BackBufferHeight = Height;
				pp.BackBufferFormat = Format.A8R8G8B8;

				
				device = new Device(d3d, 0, DeviceType.Hardware, Handle,
				                	CreateFlags.HardwareVertexProcessing, pp);

				lineData = new LineVertex[100];
				
				for (int i = 0; i < lineData.Length; i++)
				{
					lineData[i] = new LineVertex();
					lineData[i].Position = new Vector3(0f, 0f, 0f);
					
					Color c = Color.FromArgb(
						rnd.Next(1, 255),
						rnd.Next(1, 255),
						rnd.Next(1, 255));
					
					lineData[i].Color = c.ToArgb();
				}
				
				timer.Interval = 10;
				timer.Start();
				timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
			}

			void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
			{
				Render();
			}

			protected override void OnClosed(EventArgs e)
			{
				device.Dispose();
				d3d.Dispose();
			}
			
			public void Render()
			{
				device.Clear(ClearFlags.Target, Color.White.ToArgb(), 0f, 1);
				
				for (int i = 0; i < lineData.Length; i++)
				{
					float x = (float) (rnd.NextDouble() * 2) - 1;
					float y = (float) (rnd.NextDouble() * 2) - 1;
					lineData[i].Position = new Vector3(x, y, 0f);
				}
				
				device.BeginScene();
				device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;
				device.DrawUserPrimitives<LineVertex>(PrimitiveType.LineList, 
				                                  	0,
				                                  	lineData.Length / 2,
				                                  	lineData);
				device.EndScene();

				device.Present();
			}
		}

		[STAThread]
		public static void Main(string[] args)
		{
				using (Form1 form = new Form1())
				{
						Application.Run(form);
				}
		}
	}
}

In Topic: VBO: How to draw many points

07 February 2011 - 05:43 PM

Sorry guys, I was confused with example number 6. The triangle uses shaders for movement.
http://ogldev.atspace.org/www/tutorial06/tutorial06.html

In Topic: [SlimDX] How to draw lines

07 February 2011 - 01:51 PM

Unfortunately I don't understand much, but if could write a tutorial then I would be very happy. :)

PARTNERS