/**
 * ToxiTea Utilization Example
 * 
 * CToxiExample.cpp
 * created on 22 de junho 2002 01:22
 *
 */

/* 
	---- Copyright (C) 2002  Jose Eduardo R. Mourão (eduardo_rdm@hotmail.com) ----
	  
	This file is part of ToxiTea.

    ToxiTea 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 2 of the License, or
    (at your option) any later version.

    ToxiTea 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 ToxiTea; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	For more information and updates visit: 
	http://toxitea.sourceforge.net
	or mail to: eduardo_rdm@hotmail.com

	COMPILING AND/OR USING YOU ARE ACCEPTING ALL TERMS ABOVE.
	THIS LICENSE CAN BE CHANGED ANY TIME FOR ANY REASON WITHOUT NO COMMUNICATION.
*/

/**
 * @author eduardo rm
 */

/*
   Some words: This method bellow its a very elegant way to build your
   toxitea-based applications, you can full customize toxitea objects
   making the framework very extensible and easy to use. 
  
*/

#include <windows.h>
#include <string>
#include <iostream.h>
#include "ToxiTea.h"


class MainRenderer: public CToxiGLRenderer {
public:
	;
	double	rot_x,
			rot_y,
			rot_z;
	
	MainRenderer(){
		this->viewportClose=0.1;
		this->viewportFar=100;
		this->viewportAngle=45;
		rot_x=0;
		rot_y=0;
		rot_z=0;
	}

	void drawScene() {
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	
		glLoadIdentity();
		glTranslatef(0.0f,0.0f,-6.0f);
		glRotatef(rot_x,1,0,0);
		glRotatef(rot_y,0,1,0);
		glRotatef(rot_z,0,0,1);
		this->sampleDrawScene();
	}

	void resizeContext() {
		this->sampleResizeContext();
	}

	void initScene() {
	}
};


class MainWindow: public CToxiWindow {
public:

	CToxiConfig MyFirstConfig;

	MainRenderer MyFirstRenderer;
	
	MainWindow() {
		MyFirstConfig.setDefaultParams();
		startWindow(MyFirstConfig,&MyFirstRenderer);
		startRenderer();
	}

	void onKeyPress(int key) {
		switch(key) {

			case VK_ESCAPE: {
				exit(0);
				break;
			}

			case VK_UP: {
				MyFirstRenderer.rot_x+=1;
				break;
			}

			case VK_DOWN: {
				MyFirstRenderer.rot_x-=1;
				break;
			}

			case VK_LEFT: {
				MyFirstRenderer.rot_z-=1;
				break;
			}
			
			case VK_RIGHT: {
				MyFirstRenderer.rot_z+=1;
				break;
			}

		}
	}
};

/** Main API Entry */
int WINAPI WinMain (	HINSTANCE hInstance, 
						HINSTANCE hPrevInstance, 
						LPSTR lpCmdLine, int nCmdShow)
{	
    CToxiTea ToxiTea;
	MainWindow window;	
	return 0;
}

 

 

 

EXAMPLES BELLOW ARE OUTDATED.

Example 1 simple window:


/**
 * ToxiTea Utilization Example - Simple example
 * 
 * CToxiExample.cpp
 * created on 22 de junho 2002 01:25
 *
 */

/**
 * @author eduardo rm
 */

#include windows.h
#include string
#include iostream.h
#include "ToxiTea.h"

void my_A(void)
{
MessageBox(NULL,"YOU PRESSED A","MSG",MB_OK|MB_ICONERROR);
} /** Main API Entry */ int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { CToxiTea ToxiTea;
CToxiConfig MyFirstConfig; MyFirstConfig.setDefaultParams();
MyFirstConfig.setWindowColorBits(16);
MyFirstConfig.setWindowSize(640,480); CToxiD3DRenderer MyFirstRenderer; // YOU CAN CHANGE THIS TO CToxiGLRenderer CToxiWindow MyFirstWindow(MyFirstConfig,&MyFirstRenderer);
MyFirstWindow.input.Keyboard.A(&my_A);
MyFirstWindow.startRenderer(); return 0; }

Example 2 threaded windows:

/**
 * ToxiTea Utilization Example - Multiple Threaded Windows
 * 
 * CToxiExample.cpp
 * created on 22 de junho 2002 01:22
 *
 */

/**
 * @author eduardo rm
 */

#include windows.h
#include string
#include iostream.h
#include "ToxiTea.h"


void start_first_window(void)
{
	CToxiConfig MyFirstConfig;
	MyFirstConfig.setDefaultParams();
	CToxiD3DRenderer MyFirstRenderer;
	CToxiWindow MyFirstWindow(MyFirstConfig,&MyFirstRenderer);
}

void start_second_window(void)
{
	CToxiConfig MyFirstConfig;
	MyFirstConfig.setDefaultParams();
	CToxiGLRenderer MySecondRenderer;
	CToxiWindow MySecondWindow(MyFirstConfig,&MySecondRenderer);
}


/** Main API Entry */
int WINAPI WinMain (	HINSTANCE hInstance, 
					HINSTANCE hPrevInstance, 
					LPSTR lpCmdLine, int nCmdShow)
{	
   CToxiTea ToxiTea;
	
	CToxiThread Wnd1, Wnd2;
	
	Wnd1.setThreadFunc(&start_first_window);
	Wnd2.setThreadFunc(&start_second_window);

	Wnd1.begin();
	Wnd2.begin();

	Wnd1.end();
	Wnd2.end();

	return 0;
}