1/*	PROJECT:		3Dmov
2	AUTHORS:		Zenja Solaja
3	COPYRIGHT:		2009 Haiku Inc
4	DESCRIPTION:	Haiku version of the famous BeInc demo 3Dmov
5
6					There is an issue in Haiku when creating a 2nd BGLView which doesn't exist in Zeta
7					(see MainWindow.cpp for details).  Until that issue is resolved,
8					I've allowed specifying of shape type (0-2) as a command line argument.
9*/
10
11#include <Application.h>
12
13#include "MainWindow.h"
14
15/*****************************
16	Main application
17******************************/
18class MainApp : public BApplication
19{
20public:
21				MainApp(MainWindow::SHAPE shape);
22
23private:
24	MainWindow	*fWindow;
25};
26
27/*	FUNCTION:		MainApp :: MainApp
28	ARGS:			none
29	RETURN:			n/a
30	DESCRIPTION:	Application constructor
31*/
32MainApp :: MainApp(MainWindow::SHAPE shape)
33	: BApplication("application/x-vnd.Haiku-3DMov")
34{
35	BRect frame(50, 50, 50+400, 50+300);
36	fWindow = new MainWindow(frame, shape);
37}
38
39/******************************
40	Program entry point
41*******************************/
42
43/*	FUNCTION:		main
44	ARGS:			arc		number of command line arguments
45					argv	vector to arguments
46	RETURN:			Exit status
47	DESCRIPTION:	main program entry point
48*/
49int main(int argc, char **argv)
50{
51	//	Check if shape specified on command line
52	MainWindow::SHAPE shape = MainWindow::BOOK;
53	if (argc > 1)
54	{
55		int value = *argv[1] - '0';
56		if (value >= 0 && value < MainWindow::NUMBER_OF_SHAPES)
57			shape = (MainWindow::SHAPE) value;
58	}
59
60	MainApp *app = new MainApp(shape);
61	app->Run();
62	delete app;
63}
64