Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Reevesy

Pages: [1]
1
DotNet / Re: View Conversion Question.
« on: September 06, 2013, 02:59:47 am »
It's a rare case involving winforms controls alignment.

The solution was super obvious I should have known that, thanks.

2
DotNet / View Conversion Question.
« on: September 06, 2013, 02:39:23 am »
Say I wanted the y distance in pixels between two points but the view is zoomed out. For example if the distance was 100 originally it would be less now that the view has changed.

How would I calculate this new distance?

Thanks.

3
DotNet / Re: Event Problems
« on: August 29, 2013, 05:41:33 am »
Any ideas?

4
DotNet / Re: Event Problems
« on: August 28, 2013, 02:57:34 am »
        public Form1()
        {
            InitializeComponent();
            this.Load += new System.EventHandler(this.Form1_Load);
            this.FormClosed += new FormClosedEventHandler(this.Form1_Closed);
            this.ResizeEnd += new EventHandler(this.Form1_ResizeEnd);
            this.MouseWheel += new MouseEventHandler(Form1_MouseWheel);
        }

        void Form1_MouseWheel(object sender, MouseEventArgs e)
        {
            Console.WriteLine("HI");
        }
 

Nothing, all the other events fire.

5
DotNet / Event Problems
« on: August 28, 2013, 01:24:20 am »
I know you must be sick of people having trouble with events, but..

I'm trying to handle the MouseWheelMoved event but I cannot get it to fire.

Definitions and such:
        private RenderWindow SFMLWindow;
        private bool FormOpen = true;
        private BaseObject baseObj = new BaseObject();
        private Grid grid;
        public static Vector2f Offset = new Vector2f(150, 20);
        public static float Scale = 1;
        private Event mainEvent = new Event();

        private void Form1_Load(object sender, EventArgs e)
        {
            SFMLWindow = new RenderWindow(this.Handle);
            SFMLWindow.Size = new Vector2u((uint)ClientSize.Width, (uint)ClientSize.Height);
            SFMLWindow.MouseWheelMoved += new EventHandler<MouseWheelEventArgs>(window_MouseWheelMoved);
            baseObj.Load("Sprites/Base.png");
            grid = new Grid(SFMLWindow);
            MainLoop();
        }
 

Loop:
        private void MainLoop()
        {
            while (FormOpen)
            {            
                Application.DoEvents();
                SFMLWindow.DispatchEvents();
                SFMLWindow.Clear(SFML.Graphics.Color.Black);
                Input.Update();
                grid = new Grid(SFMLWindow);//TODO: Move stuff from constructor to Update().
                MWheelInput();
                //Draw
                baseObj.Draw(SFMLWindow);
                grid.Draw(SFMLWindow);
                //
                SFMLWindow.Display();        
            }
        }
 

How I tried to handle the event:
        private void window_MouseWheelMoved(object sender, MouseWheelEventArgs e)
        {
            //Tried this first.
            Console.WriteLine("roll");
        }

        private void MWheelInput()
        {
            if (mainEvent.Type == EventType.MouseWheelMoved)
            {
                Console.WriteLine("roll");
            }
        }

Neither seem to work, it's probably something stupid. Any help would be much appreciated.

Pages: [1]
anything