Exemplo n.º 1
0
int main(void)
{
    initscr();
    cbreak();
    curs_set(0);
    nodelay(stdscr, TRUE);

    sleep(1);

    int y, x;

    getmaxyx(stdscr, y, x);
 /*   _shape *box = create_shape_box(5, 5, y/2, x/2);
    draw_stuff(box);*/
    
    _shape_book *s_book = create_box_system(5, 2);
    draw_stuff(s_book);

    while (getch() != 'q') {
        move_shape(s_book);
        draw_stuff(s_book);
        usleep(95000);
    }
    
    endwin();   
    return 0;
}
Exemplo n.º 2
0
static void	app(t_game *game)
{
	t_level		*current;

	init_glfw(game);
	current = game->levels;
	while (current)
	{
		load_level(game, current);
		while (!glfwWindowShouldClose(game->window) && !game->win)
		{
			update_time(game);
			if (game->started && !game->paused)
			{
				do_gl_stuff(game);
				move_ball(game);
				check_collision(game);
				draw_stuff(game);
				check_game_state(game);
				glfwSwapBuffers(game->window);
				usleep(12500);
			}
			glfwPollEvents();
			usleep(100);
		}
		current = current->next;
	}
}
void 
my_display(void)
{

   /* Clear the window. */
   glClearColor(0.0, 0.0, 0.0, 0.0);
   glClear(GL_COLOR_BUFFER_BIT);

   draw_stuff();

   glutSwapBuffers();
}
Exemplo n.º 4
0
void go()
{
int view_pass;
glClear(GL_ACCUM_BUFFER_BIT);
for(view_pass=0;view_pass<VPASSES;view_pass++){
	jitter_view();
	draw_stuff();
	glFlush();
	glAccum(GL_ACCUM,1.0/(float)(VPASSES));
	}
glAccum(GL_RETURN,1.0);
}
Exemplo n.º 5
0
static void
redraw_handler(struct widget *widget, void *data)
{
	struct flower *flower = data;
	cairo_surface_t *surface;

	surface = window_get_surface(flower->window);
	if (surface == NULL ||
	    cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
		fprintf(stderr, "failed to create cairo egl surface\n");
		return;
	}

	draw_stuff(surface, flower->width, flower->height);
	cairo_surface_destroy(surface);
}
Exemplo n.º 6
0
//AntiAliasing routine
void draw_AA()
{
	int view_pass;
	point reverseJitter;

	glClear(GL_ACCUM_BUFFER_BIT);
	for(view_pass=0; view_pass < AA_PASSES; view_pass++){
		//Jitter translates the modelview by a tiny amount. ReverseJitter will be used to translate the modelview back to its original position
		//after the jittered image is recorded in the accumulation buffer
		reverseJitter = jitter_view();
		//draw to dynamic cubemap
		//	drawCubeMap(reverseJitter);	
		draw_stuff();	
		glAccum(GL_ACCUM,1.0/(float)(AA_PASSES));
		glTranslatef(-reverseJitter.x,-reverseJitter.y,-reverseJitter.z);
	}
	glAccum(GL_RETURN,1.0);
	glutSwapBuffers();
}
Exemplo n.º 7
0
/*
 On Redraw request, erase the window and redraw everything
 */
void RenderScene(){
  switch (RENDER_MODE) {
    case GL_CONTROL_DEF::KRM_AAONLY:
      cout<<AALevel<<"x AA"<<endl;
      camera->AAPerspectiveDisplay(WIDTH, HEIGHT, AALevel, draw_stuff);
      break;
    case GL_CONTROL_DEF::KRM_DOF_ONLY:
      cout<<"DoF at focus:"<<camera->focus()<<endl;
      glEnable(GL_MULTISAMPLE);
      camera->DoFPerspectiveDisplay(WIDTH, HEIGHT, 10, draw_stuff);
      break;
    default:
      camera->PerspectiveDisplay(WIDTH, HEIGHT);
      draw_stuff();
  }
  glFlush();
  glutSwapBuffers();
  WantToRedraw = false;
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
	cairo_surface_t *s;
	struct flower flower;
	struct display *d;
	struct timeval tv;

	d = display_create(&argc, &argv, NULL, NULL);
	if (d == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	gettimeofday(&tv, NULL);
	srandom(tv.tv_usec);

	flower.width = 200;
	flower.height = 200;
	flower.display = d;
	flower.window = window_create(d, flower.width, flower.height);

	window_set_title(flower.window, "flower");
	window_set_decoration(flower.window, 0);
	window_draw(flower.window);
	s = window_get_surface(flower.window);
	if (s == NULL || cairo_surface_status (s) != CAIRO_STATUS_SUCCESS) {
		fprintf(stderr, "failed to create cairo egl surface\n");
		return -1;
	}

	draw_stuff(s, flower.width, flower.height);
	cairo_surface_flush(s);
	cairo_surface_destroy(s);
	window_flush(flower.window);

	window_set_motion_handler(flower.window, motion_handler);
	window_set_button_handler(flower.window, button_handler);
	window_set_user_data(flower.window, &flower);
	display_run(d);

	return 0;
}
Exemplo n.º 9
0
int main(int argc, char *argv[])
{
	struct wl_display *display;
	cairo_surface_t *s;
	struct timespec ts;
	GMainLoop *loop;
	GSource *source;
	struct flower flower;

	loop = g_main_loop_new(NULL, FALSE);

	display = wl_display_create(socket_name);
	if (display == NULL) {
		fprintf(stderr, "failed to create display: %m\n");
		return -1;
	}

	source = wayland_source_new(display);
	g_source_attach(source, NULL);

	flower.x = 512;
	flower.y = 384;
	flower.width = 200;
	flower.height = 200;
	flower.surface = wl_display_create_surface(display);

	clock_gettime(CLOCK_MONOTONIC, &ts);
	srandom(ts.tv_nsec);
	flower.i = ts.tv_nsec;

	s = draw_stuff(flower.width, flower.height);
	flower.buffer = wl_buffer_create_from_cairo_surface(display, s);

	wl_surface_attach_buffer(flower.surface, flower.buffer);

	g_timeout_add(20, move_flower, &flower);

	g_main_loop_run(loop);

	return 0;
}
Exemplo n.º 10
0
static void
redraw_handler(struct widget *widget, void *data)
{
	struct transformed *transformed = data;
	struct rectangle allocation;
	cairo_surface_t *surface;
	cairo_t *cr;

	surface = window_get_surface(transformed->window);
	if (surface == NULL ||
	    cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
		fprintf(stderr, "failed to create cairo egl surface\n");
		return;
	}

	widget_get_allocation(transformed->widget, &allocation);

	cr = widget_cairo_create(widget);
	draw_stuff(cr, allocation.width, allocation.height);

	cairo_surface_destroy(surface);
}
Exemplo n.º 11
0
int	main(int argc, char *argv[])
{
	// Initialize the SDL subsystems we're using.
	if (SDL_Init(SDL_INIT_VIDEO /* | SDL_INIT_JOYSTICK | SDL_INIT_CDROM | SDL_INIT_AUDIO*/))
	{
		fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

	int	width = 1000;
	int	height = 1000;

	// Set the video mode.
	if (SDL_SetVideoMode(width, height, 16 /* 32 */, SDL_OPENGL) == 0)
	{
		fprintf(stderr, "SDL_SetVideoMode() failed.");
		exit(1);
	}

	ogl::open();

	// Turn on alpha blending.
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glMatrixMode(GL_PROJECTION);
	glOrtho(0, 1000, 0, 1000, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	float	lod_tweak = 1.0f;

	// Mouse state.
	int	mouse_x = 0;
	int	mouse_y = 0;
	int	mouse_buttons = 0;

	bool	paused = false;
	float	speed_scale = 1.0f;
	Uint32	last_ticks = SDL_GetTicks();
	for (;;)
	{
		Uint32	ticks = SDL_GetTicks();
		int	delta_ticks = ticks - last_ticks;
		float	delta_t = delta_ticks / 1000.f;
		last_ticks = ticks;

		if (paused == true)
		{
			delta_t = 0.0f;
		}

		// Handle input.
		SDL_Event	event;
		while (SDL_PollEvent(&event))
		{
			switch (event.type)
			{
			case SDL_KEYDOWN:
			{
				int	key = event.key.keysym.sym;

				if (key == SDLK_q || key == SDLK_ESCAPE)
				{
					exit(0);
				}
				else if (key == SDLK_k)
				{
					lod_tweak = fclamp(lod_tweak + 0.1f, 0.1f, 3.0f);
					printf("lod_tweak = %f\n", lod_tweak);
				}
				else if (key == SDLK_j)
				{
					lod_tweak = fclamp(lod_tweak - 0.1f, 0.1f, 3.0f);
					printf("lod_tweak = %f\n", lod_tweak);
				}
				break;
			}

			case SDL_MOUSEMOTION:
				mouse_x = (int) (event.motion.x);
				mouse_y = (int) (event.motion.y);
				break;

			case SDL_MOUSEBUTTONDOWN:
			case SDL_MOUSEBUTTONUP:
			{
				int	mask = 1 << (event.button.button);
				if (event.button.state == SDL_PRESSED)
				{
					mouse_buttons |= mask;
				}
				else
				{
					mouse_buttons &= ~mask;
				}
				break;
			}

			case SDL_QUIT:
				exit(0);
				break;

			default:
				break;
			}
		}

		glDisable(GL_DEPTH_TEST);	// Disable depth testing.
		glDrawBuffer(GL_BACK);
		glClear(GL_COLOR_BUFFER_BIT);

		draw_stuff(float(mouse_x), 1000.0f - float(mouse_y), lod_tweak);

		SDL_GL_SwapBuffers();

		SDL_Delay(10);
	}

	return 0;
}
Exemplo n.º 12
0
int	main(int argc, char *argv[])
{
	print_usage();

	// Initialize the SDL subsystems we're using.
	if (SDL_Init(SDL_INIT_VIDEO /* | SDL_INIT_JOYSTICK | SDL_INIT_CDROM | SDL_INIT_AUDIO*/))
	{
		fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

	int	width = 1000;
	int	height = 1000;

	// Set the video mode.
	if (SDL_SetVideoMode(width, height, 16 /* 32 */, SDL_OPENGL) == 0)
	{
		fprintf(stderr, "SDL_SetVideoMode() failed.");
		exit(1);
	}

	ogl::open();

	// Turn on alpha blending.
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glMatrixMode(GL_PROJECTION);
	glOrtho(0, 1000, 0, 1000, -1, 1);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslatef(500, 500, 0);

	float	density = 1.0f;


	// Add a couple occluders.
	s_occluders.push_back(occluder(vec3(0,0,0), 20));
	s_occluders.push_back(occluder(vec3(100,50,0), 20));
	s_occluders.push_back(occluder(vec3(-100,50,0), 20));

	// Mouse state.
	controls	c;
//	int	mouse_x = 0;
//	int	mouse_y = 0;
//	int	mouse_buttons = 0;

	bool	paused = false;
	float	speed_scale = 1.0f;
	Uint32	last_ticks = SDL_GetTicks();
	for (;;)
	{
		Uint32	ticks = SDL_GetTicks();
		int	delta_ticks = ticks - last_ticks;
		float	delta_t = delta_ticks / 1000.f;
		last_ticks = ticks;

		if (paused == true)
		{
			delta_t = 0.0f;
		}

		// Handle input.
		c.m_mouse_left_click = false;
		c.m_mouse_right_click = false;
		SDL_Event	event;
		while (SDL_PollEvent(&event))
		{
			switch (event.type)
			{
			case SDL_KEYDOWN:
			{
				int	key = event.key.keysym.sym;

				if (key == SDLK_q || key == SDLK_ESCAPE)
				{
					exit(0);
				}
				else if (key == SDLK_k)
				{
					density = fclamp(density + 0.1f, 0.1f, 3.0f);
					printf("density = %f\n", density);
				}
				else if (key == SDLK_j)
				{
					density = fclamp(density - 0.1f, 0.1f, 3.0f);
					printf("density = %f\n", density);
				}
				else if (key == SDLK_LCTRL || key == SDLK_RCTRL)
				{
					c.m_ctl = true;
				}
				else if (key == SDLK_LSHIFT || key == SDLK_RSHIFT)
				{
					c.m_shift = true;
				}
				else if (key == SDLK_LALT || key == SDLK_RALT)
				{
					c.m_alt = true;
				}
				break;
			}

			case SDL_KEYUP:
			{
				int	key = event.key.keysym.sym;

				if (key == SDLK_LCTRL || key == SDLK_RCTRL)
				{
					c.m_ctl = false;
				}
				else if (key == SDLK_LSHIFT || key == SDLK_RSHIFT)
				{
					c.m_shift = false;
				}
				else if (key == SDLK_LALT || key == SDLK_RALT)
				{
					c.m_alt = false;
				}
				break;
			}

			case SDL_MOUSEMOTION:
				c.m_mouse_x = float((int) (event.motion.x));
				c.m_mouse_y = float((int) (event.motion.y));
				break;

			case SDL_MOUSEBUTTONDOWN:
			case SDL_MOUSEBUTTONUP:
			{
				int	mask = 1 << (event.button.button);
				bool	down = (event.button.state == SDL_PRESSED);
				bool	clicked = (event.type == SDL_MOUSEBUTTONDOWN);
				if (event.button.button == 1)
				{
					c.m_mouse_left = down;
					c.m_mouse_left_click = clicked;
				}
				if (event.button.button == 3)
				{
					c.m_mouse_right = down;
					c.m_mouse_right_click = clicked;
				}

				break;
			}

			case SDL_QUIT:
				exit(0);
				break;

			default:
				break;
			}
		}

		glDisable(GL_DEPTH_TEST);	// Disable depth testing.
		glDrawBuffer(GL_BACK);
		glClear(GL_COLOR_BUFFER_BIT);

		draw_stuff(c, density);

		SDL_GL_SwapBuffers();

		SDL_Delay(10);
	}

	return 0;
}
Exemplo n.º 13
0
MRESULT EXPENTRY main_proc(
    HWND                hwnd,
    ULONG               msg,
    MPARAM              mp1,
    MPARAM              mp2
) {
    if( msg == WM_CREATE ) {

        PCREATESTRUCT   pcreate;

        pcreate = ( CREATESTRUCT * ) mp2;
        Draw_area.xRight = pcreate->x + pcreate->cx;
        Draw_area.yTop = pcreate->y + pcreate->cy;
        Draw_area.yBottom = pcreate->y;
        Draw_area.xLeft = pcreate->x;
//      WinQueryWindowRect( hwnd, &Draw_area );

    } else if( msg == WM_COMMAND || ( msg == WM_CONTROL &&
                                SHORT2FROMMP( mp1 ) != BN_PAINT ) ) {

        switch( SHORT1FROMMP( mp1 ) ) {

        case IDM_EXIT:
            new_display();
            WinPostMsg( hwnd, WM_QUIT, 0L, 0L );
            return( NULL );

        case IDM_ROTATE_LEFT:
            new_display();
            add_wrap( THREE_D_HORZ_ANGLE, -15, 0, 360 );
            break;
        case IDM_ROTATE_RIGHT:
            new_display();
            add_wrap( THREE_D_HORZ_ANGLE, 15, 0, 360 );
            break;
        case IDM_ROTATE_UP:
            new_display();
            add_range( THREE_D_VERT_ANGLE, 5, -90, 90 );
            break;
        case IDM_ROTATE_DOWN:
            new_display();
            add_range( THREE_D_VERT_ANGLE, -5, -90, 90 );
            break;
        case IDM_MOVE_IN:
            new_display();
            add_range(THREE_D_ZOOM, 10, 5, 200 );
            break;
        case IDM_MOVE_OUT:
            new_display();
            add_range( THREE_D_ZOOM, -10, 5, 200 );
            break;
        case IDM_MORE_PERSPECTIVE:
            new_display();
            add_range( THREE_D_PERSPECTIVE, 10, 5, 200 );
            break;
        case IDM_LESS_PERSPECTIVE:
            new_display();
            add_range( THREE_D_PERSPECTIVE, -10, 5, 200 );
            break;
        case IDM_MORE_CONTRAST:
            new_display();
            add_range( THREE_D_CONTRAST, 10, 0, 100 );
            break;
        case IDM_LESS_CONTRAST:
            new_display();
            add_range( THREE_D_CONTRAST, -10, 0, 100 );
            break;
        case IDM_MORE_BRIGHTNESS:
            new_display();
            add_range( THREE_D_BRIGHTNESS, 10, 0, 100 );
            break;
        case IDM_LESS_BRIGHTNESS:
            new_display();
            add_range( THREE_D_BRIGHTNESS, -10, 0, 100 );
            break;
        case IDM_LIGHT_HORZ_LEFT:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_HORZ, 1 );
            break;
        case IDM_LIGHT_HORZ_MIDDLE:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_HORZ, 2 );
            break;
        case IDM_LIGHT_HORZ_RIGHT:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_HORZ, 3 );
            break;
        case IDM_LIGHT_VERT_TOP:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_VERT, 1 );
            break;
        case IDM_LIGHT_VERT_MIDDLE:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_VERT, 2 );
            break;
        case IDM_LIGHT_VERT_BOTTOM:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_VERT, 3 );
            break;
        case IDM_LIGHT_DEPTH_FRONT:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_DEPTH, 1 );
            break;
        case IDM_LIGHT_DEPTH_MIDDLE:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_DEPTH, 2 );
            break;
        case IDM_LIGHT_DEPTH_BACK:
            new_display();
            three_d_set( hThree_d, THREE_D_LIGHT_DEPTH, 3 );
            break;
        default:
            ;
        }
        WinInvalidateRect( hwnd, &Draw_area,
                        SHORT1FROMMP( mp1 ) >= IDM_FIRST_REQUIRING_CLEAR );

    } else if( msg == WM_DESTROY ) {
        WinPostMsg( hwnd, WM_QUIT, 0L, 0L );
        return( 0 );

    } else if( msg == WM_PAINT ) {
        draw_stuff( hwnd );
        if( Auto_run ) {
            if( Auto_run == 5 ) {
                WinPostMsg( hwnd, WM_QUIT, 0L, 0L );
            } else {
                long count;
                int will_be_one;
                will_be_one = 1;
                for(count = 0; count < 1000000; ++ count ) will_be_one ^= 1;

                Auto_run += will_be_one;
                WinPostMsg( hwnd, WM_COMMAND,
                        MPFROMSHORT( IDM_ROTATE_LEFT ), 0L );
            }
        }
        return( 0 );

    } else if( msg == WM_SIZE ) {
        WinQueryWindowRect( hwnd, &Draw_area );
        Draw_area.yTop -= Button_height;
        WinInvalidateRect( hwnd, NULL, TRUE );
        return( 0 );

    } else if( msg == WM_MEASUREITEM ) {
        return( (MRESULT) measure_button( hwnd, mp1, mp2 ) );

    } else if( msg == WM_CONTROL && SHORT2FROMMP( mp1 ) == BN_PAINT ) {
        draw_button( mp1, mp2 );
        return( (MRESULT) TRUE );

    }

    return( (MRESULT) WinDefWindowProc( hwnd, msg, mp1, mp2 ) );
}
Exemplo n.º 14
0
LRESULT CALLBACK main_proc(
    HWND                hwnd,
    UINT                msg,
    WPARAM              wparam,
    LPARAM              lparam
) {
    WORD                cmd;

    switch( msg ) {

    case WM_CREATE: {
        GetClientRect( hwnd, &Draw_area );
        make_buttons( hwnd );
        break;
    }

    case WM_COMMAND:
        cmd = LOWORD( wparam );
        switch( LOWORD( cmd ) ) {

        case IDM_EXIT:
            PostQuitMessage( 0 );
            return( FALSE );

        case IDM_ROTATE_LEFT:
            add_wrap( THREE_D_HORZ_ANGLE, -15, 0, 360 );
            break;
        case IDM_ROTATE_RIGHT:
            add_wrap( THREE_D_HORZ_ANGLE, 15, 0, 360 );
            break;
        case IDM_ROTATE_UP:
            add_range( THREE_D_VERT_ANGLE, 5, -90, 90 );
            break;
        case IDM_ROTATE_DOWN:
            add_range( THREE_D_VERT_ANGLE, -5, -90, 90 );
            break;
        case IDM_MOVE_IN:
            add_range(THREE_D_ZOOM, 10, 5, 200 );
            break;
        case IDM_MOVE_OUT:
            add_range( THREE_D_ZOOM, -10, 5, 200 );
            break;
        case IDM_MORE_PERSPECTIVE:
            add_range( THREE_D_PERSPECTIVE, 10, 5, 200 );
            break;
        case IDM_LESS_PERSPECTIVE:
            add_range( THREE_D_PERSPECTIVE, -10, 5, 200 );
            break;
        case IDM_MORE_CONTRAST:
            add_range( THREE_D_CONTRAST, 10, 0, 100 );
            break;
        case IDM_LESS_CONTRAST:
            add_range( THREE_D_CONTRAST, -10, 0, 100 );
            break;
        case IDM_MORE_BRIGHTNESS:
            add_range( THREE_D_BRIGHTNESS, 10, 0, 100 );
            break;
        case IDM_LESS_BRIGHTNESS:
            add_range( THREE_D_BRIGHTNESS, -10, 0, 100 );
            break;
        case IDM_LIGHT_HORZ_LEFT:
            three_d_set( hThree_d, THREE_D_LIGHT_HORZ, 1 );
            break;
        case IDM_LIGHT_HORZ_MIDDLE:
            three_d_set( hThree_d, THREE_D_LIGHT_HORZ, 2 );
            break;
        case IDM_LIGHT_HORZ_RIGHT:
            three_d_set( hThree_d, THREE_D_LIGHT_HORZ, 3 );
            break;
        case IDM_LIGHT_VERT_TOP:
            three_d_set( hThree_d, THREE_D_LIGHT_VERT, 1 );
            break;
        case IDM_LIGHT_VERT_MIDDLE:
            three_d_set( hThree_d, THREE_D_LIGHT_VERT, 2 );
            break;
        case IDM_LIGHT_VERT_BOTTOM:
            three_d_set( hThree_d, THREE_D_LIGHT_VERT, 3 );
            break;
        case IDM_LIGHT_DEPTH_FRONT:
            three_d_set( hThree_d, THREE_D_LIGHT_DEPTH, 1 );
            break;
        case IDM_LIGHT_DEPTH_MIDDLE:
            three_d_set( hThree_d, THREE_D_LIGHT_DEPTH, 2 );
            break;
        case IDM_LIGHT_DEPTH_BACK:
            three_d_set( hThree_d, THREE_D_LIGHT_DEPTH, 3 );
            break;
        default:
            ;
        }
        InvalidateRect( hwnd, &Draw_area, cmd >= IDM_FIRST_REQUIRING_CLEAR );
        break;

    case WM_DESTROY:
        PostQuitMessage( 0 );
        return( FALSE );

    case WM_PAINT:
        draw_stuff( hwnd );
        if( Auto_run ) {
            if( Auto_run == 5 ) {
                PostQuitMessage( 0 );
            } else {
                long count;
                int will_be_one;
                will_be_one = 1;
                for(count = 0; count < 1000000; ++ count ) will_be_one ^= 1;

                Auto_run += will_be_one;
                PostMessage( hwnd, WM_COMMAND,
                                GET_WM_COMMAND_MPS( IDM_ROTATE_LEFT, 0, 0 ) );
            }
        }
        return( FALSE );

    case WM_SIZE:
        if( wparam != SIZEICONIC ) {
            int old_left = Draw_area.left;

            GetClientRect( hwnd, &Draw_area );
            Draw_area.left = old_left;
            InvalidateRect( hwnd, NULL, TRUE );
            return( FALSE );
        }
        break;

    case WM_MEASUREITEM:
        measure_button( hwnd, wparam, _lparam_pointer( lparam ) );
        return( TRUE );

    case WM_DRAWITEM:
        draw_button( wparam, _lparam_pointer( lparam ) );
        return( TRUE );

    }

    return( DefWindowProc( hwnd, msg, wparam, lparam ) );
}