Click here to Skip to main content
15,881,757 members
Articles / Desktop Programming / MFC

2D LUA Based Robot Simulator

Rate me:
Please Sign up or sign in to vote.
4.89/5 (26 votes)
14 Apr 2014Public Domain9 min read 130.6K   7.9K   119  
An article on designing your own robot simulator
// NiceView.h : interface of the CNiceView class
//


#pragma once

#include "robot.h"
#include "Evaluate.h"
#include "PropertyDlg.h"
#include "SetPropertyDlg.h"
#include "EditorDlg.h"
#include "LogDlg.h"

#include "Canvas.h"

// Timer ID constants
const UINT ID_TIMER_SIMULATION  = 0x1001;
/////////////////////////////////////////////////////////////////////////////////////////

class CNiceView : public CView
{
protected: // create from serialization only
	CNiceView();
	DECLARE_DYNCREATE(CNiceView)

// Attributes
public:
	CNiceDoc* GetDocument() const;

// Operations
public:

// Overrides
public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

protected:

// Implementation
public:
	virtual ~CNiceView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif
	static DWORD WINAPI simulationThread(LPVOID param);
	void simulationThreadWorker();

protected:

private:
	CRobot m_robot;
	CPropertyDlg *m_propertyDlg;
	CEditorDlg *m_editorDlg;
	CEvaluate *m_evaluate;
	CLogDlg *m_logDlg;
	CCanvas m_canvas;
	bool m_bRunning;
	bool m_bManuallyMoved;
	double *t;
	CPoint m_ptStart;
	CPoint m_ptEnd;

// Generated message map functions
protected:
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnUpdateRunButton(CCmdUI* pCmdUI);
	afx_msg void UnUpdateStopButton(CCmdUI* pCmdUI);
	afx_msg void OnViewProperty();
	afx_msg void OnViewEditor();
	afx_msg void OnViewSetProperty();
	afx_msg void OnViewLog();
	afx_msg void OnRun();
	afx_msg void OnStop();
	afx_msg void OnBtRect();
	afx_msg void OnBtCirc();
	afx_msg void OnBtLine();
	afx_msg void OnBtDel();
	afx_msg void OnResetRobot();
	afx_msg void OnClearWorld();
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in NiceView.cpp
inline CNiceDoc* CNiceView::GetDocument() const
   { return reinterpret_cast<CNiceDoc*>(m_pDocument); }
#endif

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, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Student
Indonesia Indonesia
http://kataauralius.com/

Comments and Discussions