Example #1
0
static void
console_task( void* unused )
{
    console_init();
    int dirty = 0;
    TASK_LOOP
    {
        // show the console only when there are no Canon dialogs on the screen
        if (console_visible && (display_idle() || is_pure_play_photo_or_movie_mode()))
        {
            if (dirty) console_draw(0);
            dirty = 1;
        }
        else if (dirty)
        {
            canon_gui_enable_front_buffer(1);
            dirty = 0;
        }
        else if (console_visible && !gui_menu_shown())
            console_draw(1);


        if (!gui_menu_shown() && strlen(console_status_text))
        {
            console_show_status();
        }

        msleep(200);
    }
}
Example #2
0
// Draw whole scene
void graph3d::draw_end(void)
{
  if(graphics) {
    clear();

    if(config.opengl_lighting) {
      gl_light::on();
    }
    
    if(p_scene_active) {
      p_scene_active->draw_end(config.draw_debug_all_objects);
    }
    
    if(config.opengl_lighting) {
      gl_light::off();
    }

    // Reset world matrix
    GPIPE *p_pipe = gpipe_get();
    if(p_pipe)
      p_pipe->world_init();
    
    if(config.draw_grid)
      grid_draw();
        
    if(p_pipe)
      p_pipe->matrix_2d_mode_set();

    if(config.draw_debug_fps)
      fps_draw();
    
    if(config.draw_console)
      console_draw();
    
    if(config.draw_mouse_cursor)
      mouse_cursor_draw();
  
    if(config.draw_selection)
      selection_rectangle_draw();
    
    if(p_pipe)
      p_pipe->matrix_3d_mode_set();
    
    flip();
  }
}
Example #3
0
/* This draws things when we are in console (paused) mode */
void console_frame(void)
{
	sprite_start_frame();
	sprite_group_draw2(mech_group);
	sprite_group_draw(bullet_group);
	sprite_group_draw(bomb_group);
	sprite_group_draw(effects_group);
	sprite_group_draw(foreground_group);
	if (inGame){
		sprite_group_draw(ui_group);
	}else{
		sprite_group_draw(ui_group_connect);
	}

	winds_change();

	draw_ui();
	console_draw();
	sprite_end_frame();
}
Example #4
0
void console_draw_from_menu()
{
    if (console_visible)
        console_draw(1);
}
Example #5
0
int main(int argc, char** argv) {
	char* filename;
	int scaleFullScreen = 0;
	Console co;
	Console* t = &co;
	int cx; int cy;
	int w, h;
	int iterX, iterY;

	struct Pix* pngfile;
	struct Pix* ping;
	struct Pix* palette;
	struct Pix* pix32;
	int i, ix, iy;
	int c;
	
	for (i = 1; i<argc; i++) {
		if (strlen(argv[i]) > 1 && !memcmp(argv[i], "-f", 2)) 
			scaleFullScreen=1;
		else filename = argv[i];
	}

	if (access(filename, R_OK)) {
		puts("file not found!");
		puts("c0npix by rofl0r");
		puts("================");
		printf("arguments: %s [-f] somefile.[jpg|png|bmp|tiff]\n", argv[0]);
		puts("where -f means scale to fullscreen");
		puts("export TERM=xterm-256color before usage is recommended.");
		exit(1);
	}

	console_init(t);
	point reso = {800, 600};
	console_init_graphics(&co, reso, FONT);

	console_getbounds(t, &cx, &cy);

	pngfile = pixRead(filename);

	pixGetDimensions(pngfile, &w, &h, NULL);

	ping = pixScale(pngfile, 2.0, 1.0 );
	
	pixDestroy(&pngfile);
	
	palette = pixOctreeColorQuant(ping, 240, 1);
	
	if (palette == NULL) { puts("palette is nul"); goto finish_him; }

	pix32 = pixConvertTo32(palette);

	iterX = pix32->w;
	iterY = pix32->h;

	int* bufptr = (int*) pix32->data;
	if (bufptr == NULL) {
		puts("bufptr is null");
		goto finish_him;
	}
	
	int startx = 0;
	int starty = 0;
	
	paint:
	for(iy = starty; iy < starty + cy; iy++) {
		bufptr = (int*) pix32->data + (iy * pix32->w) + startx;
		for(ix = startx; ix < startx + cx; ix++) {
			console_setcolor(t, 0, *((rgb_t*) bufptr));
			console_goto(t, ix - startx, iy - starty);
			console_addchar(t, ' ', 0);
			bufptr++;
		}
	}
	console_draw(t);
	//console_printfxy(t, 0, 0, "%d", (int) c);
	
	while ((c = console_getkey(t)) != 'q') {

		console_setcolor(t, 0, RGB(0,0,0));
		
		switch(c) {
			case CK_CURSOR_UP: 
				if(starty > 0) starty--;
				break;
			case CK_CURSOR_DOWN:
				if(starty < (int) pix32->h - cy)
					starty++;
				break;
			case CK_CURSOR_LEFT:
				if(startx > 0)
					startx--;
				break;
			case CK_CURSOR_RIGHT:
				if(startx < (int) pix32->w - cx)
					startx++;
				break;
			default:
				goto loopend; // ignore mouse movement and similar stuff
				break;
		}
		goto paint;
		loopend: ;
	}
	
	pixDestroy(&palette);
	pixDestroy(&pix32);

	console_refresh(t);
	
	finish_him:
	//console_getkey(t);
	
	console_cleanup(t);

	return 0;
}