/*************************************************************************** * Copyright (C) 2008 by Eduard Grinke & Simon Martin Reich * * University of Goettingen, Germany * * * * 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, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * * * * * * OpenGL needs to be installed, more information can be found at: * * http://www.opengl.org/ * * * * Please remember to set the correct linker flag, in most cases * * something like: * * Project | Project Options | Configure Options | flags : -lglut * * * * * * * * https://sourceforge.net/projects/especially * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include using namespace std; int main(int argc, char *argv[]) { // now we want to add a few things to our first program in tutorial 1. First that black fps message. Wouldn't it look good in red in the left upper corner? ESv_fps_color_red = 1.0f; ESv_fps_color_green = 0.0f; ESv_fps_color_blue = 0.0f; // the amount of pixels available on the screen depends on the screen resolution. So according to your settings you might need to adapt the following lines. The position works fine for me, but might not for you :) ESv_fps_pos_x =-28.0f; ESv_fps_pos_y = 20.0f; // I hope you tried pressing F2 at some point of time. Of course that cool effect can be initialized at start up of the program (extremly useful for graphs as we will see in the next tutorial). Just uncomment the next line. // ESv_leavebuffer = true; // we already had that one ES_start( "ESpecially-Engine - Tutorial 2", false, true, 1.0f, 1.0f, 1.0f, argc, argv ); return EXIT_SUCCESS; } // Now this is our callback from Especially. All our drawing and calculations go here. It is called every frame. int ES_render() { // same stuff as in tutorial 1 ES_coorsys2d( 0.0f, 0.0f, -10.0f, 10.0f, -10.0f, 10.0f, true, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f ); ES_drawmass( sin(ESv_programtime/100)*3, cos(ESv_programtime/1000)*4, 2, 0.2, false, true, 0.0f, 0.5f, 1.0f ); // but now we want the fps message only show when the circle is in the upper part of the coordinate system: if( cosf(ESv_programtime/1000)*4 >= 0 ) ESv_fps_activ = true; else ESv_fps_activ=false; return true; }