view native/OpenHaptics/XYPad/XYScene.h @ 1:46671fc7d649 tip

fixed "window" message bug and brought the message outside the haptic device monitor
author Fiore Martin <f.martin@qmul.ac.uk>
date Fri, 13 Mar 2015 13:02:16 +0000
parents 011caca7515a
children
line wrap: on
line source
/*
XYPad - a haptic xy-pad that uses the jHapticGUI library

Copyright (C) 2015  Queen Mary University of London (http://depic.eecs.qmul.ac.uk/)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "HapticScene.h"
#include <HL/hl.h>

namespace jhapticgui {
	class XYScene : public HapticScene
	{
		enum class Shape { SQUARE, CIRCLE };
		static const double RADIUS;

		HLuint shapeID;
		bool isTouching = false;
		Shape shape = Shape::CIRCLE;
		
	public:
		XYScene(void(*messageCallback) (const Message & m));
		~XYScene();

		bool initHaptics(void);

		void initGL(void);

		unsigned int processMessage(const Message & m);

		void beginFrame(void); 

		void endFrame(void);

		void drawCursor(void);

		void drawScene(unsigned int messageUpdate, unsigned int callbacksUpdate);

		unsigned int checkCallbacks(void);
		 
		static void HLCALLBACK checkContact(HLenum event, HLuint object, HLenum thread, HLcache *cache, void *userdata);
		static void HLCALLBACK checkMotion(HLenum event, HLuint object, HLenum thread, HLcache *cache, void *userdata);

	};
}