Пример #1
0
void VideoInputGui::draw_video_input()
{
    const AbstractVideoInput::input_image_view_t &left_input_view = application.video_input_p->get_left_image();
    const AbstractVideoInput::input_image_view_t &right_input_view = application.video_input_p->get_right_image();

    boost::gil::copy_and_convert_pixels(left_input_view, screen_left_view);
    boost::gil::copy_and_convert_pixels(right_input_view, screen_right_view);

    blit_to_screen();

    return;
}
Пример #2
0
  void choose_menu(menu_type *new_menu)
  {
    if(new_menu == NULL)
      new_menu = &main_menu;

    clear_screen(COLOR_BG);
#if !defined(ZAURUS) && !defined(DINGUX_ON_WIN32)
    blit_to_screen(original_screen, 240, 160, 230, 40);
#endif
    current_menu = new_menu;
    current_option = new_menu->options;
    current_option_num = 0;
    if(current_menu->init_function)
     current_menu->init_function();
  }
Пример #3
0
  void choose_menu(menu_type *new_menu)
  {
    if(new_menu == NULL)
      new_menu = &main_menu;

    clear_screen(COLOR_BG);

    blit_to_screen(original_screen, 240, 160, 230, 40);

    current_menu = new_menu;
    current_option = new_menu->options;
    current_option_num = 0;
    if(current_menu->init_function)
     current_menu->init_function();
  }
Пример #4
0
void get_savestate_snapshot(u8 *savestate_filename)
{
  u16 snapshot_buffer[240 * 160];
  u8 savestate_timestamp_string[80];

  file_open(savestate_file, savestate_filename, read);

  if(file_check_valid(savestate_file))
  {
    u8 weekday_strings[7][11] =
    {
      "Sunday", "Monday", "Tuesday", "Wednesday",
      "Thursday", "Friday", "Saturday"
    };
    time_t savestate_time_flat;
    struct tm *current_time;
    file_read_array(savestate_file, snapshot_buffer);
    file_read_variable(savestate_file, savestate_time_flat);

    file_close(savestate_file);

    current_time = localtime(&savestate_time_flat);
    sprintf(savestate_timestamp_string,
     "%s  %02d/%02d/%04d  %02d:%02d:%02d                ",
     weekday_strings[current_time->tm_wday], current_time->tm_mon + 1,
     current_time->tm_mday, current_time->tm_year + 1900,
     current_time->tm_hour, current_time->tm_min, current_time->tm_sec);

    savestate_timestamp_string[40] = 0;
    print_string(savestate_timestamp_string, COLOR_HELP_TEXT, COLOR_BG,
     10, 40);
  }
  else
  {
    memset(snapshot_buffer, 0, 240 * 160 * 2);
    print_string_ext("No savestate exists for this slot.",
     0xFFFF, 0x0000, 15, 75, snapshot_buffer, 240, 0);
    print_string("---------- --/--/---- --:--:--          ", COLOR_HELP_TEXT,
     COLOR_BG, 10, 40);
  }

#ifndef GP2X_BUILD
  blit_to_screen(snapshot_buffer, 240, 160, 230, 40);
#endif
}
Пример #5
0
/* Renders one frame and handles the SDL window */
void
pn_render (void)
{
  SDL_Event event;

  /* Handle window events */
  while (SDL_PollEvent (&event))
    {
      switch (event.type)
	{
	case SDL_QUIT:
	  pn_quit ();
	  g_assert_not_reached ();
	case SDL_KEYDOWN:
	  switch (event.key.keysym.sym)
	    {
	    case SDLK_ESCAPE:
	      pn_quit ();
	      g_assert_not_reached ();
	    case SDLK_RETURN:
	      if (event.key.keysym.mod & (KMOD_ALT | KMOD_META))
		toggle_fullscreen ();
	      break;
	    case SDLK_BACKQUOTE:
	      take_screenshot ();
	      break;
	    default:
              break;
	    }
	  break;
	case SDL_VIDEORESIZE:
	  resize_video (event.resize.w, event.resize.h);
	  break;
	}
    }

  pn_new_beat = pn_is_new_beat();

  if (pn_rc->actuator)
    {
      exec_actuator (pn_rc->actuator);
      blit_to_screen ();
    }
}
Пример #6
0
void cmd_run(Ttoken *t) {
	Tscript_object *o;
	int loops;
	static int i = 0;

	loops = atoi(t->word);

	cycle_count = 0;
	while(loops && !script_done) {

		while(cycle_count > 0 && loops && !script_done) {
			logic_count ++;

			poll_music();

			// update objects
			o = objects;
			while(o != NULL) {
				if (!o->line) {
					o->x += o->vx;
					o->y += o->vy;
				}
				o = (Tscript_object *) o->next;
			}

			if (key[KEY_ESC]) script_done = -1;

			i ++;
			loops --;
			cycle_count --;
		}

		// let other processes play
		yield_timeslice();

		// blit buffer to swap buffer
		blit(buffer, swap_buffer, 0, 0, 0, 0, 160, 120);
		
		// draw objects
		o = objects;
		while(o != NULL) {
			if (o->bmp[0] != NULL) {
				int frame = (o->frames ? logic_count % o->frames : 0);
				if (o->dir == 1)
					draw_sprite_h_flip(swap_buffer, o->bmp[frame], o->x, o->y);
				else if (o->dir == 0)
					draw_sprite(swap_buffer, o->bmp[frame], o->x, o->y);
				else // rotate
					rotate_sprite(swap_buffer, o->bmp[frame], o->x, o->y, itofix(-8*i));
			}
			else if (o->line) {
				line(swap_buffer, ((Tscript_object *)o->line_from)->x + o->x,
					((Tscript_object *)o->line_from)->y + o->y,
					((Tscript_object *)o->line_to)->x + o->vx,
					((Tscript_object *)o->line_to)->y + o->vy,
					1);
			}
			o = (Tscript_object *) o->next;
		}
		
		// blit to screen
		blit_to_screen(swap_buffer);
	}
	
}
Пример #7
0
void cmd_blit() {
	blit_to_screen(swap_buffer);
}
Пример #8
0
void Editor::draw()
{
    // Draw the map
    // If drawing takes very long, wait until after dragging.
    if (draw_required && (draw_dragging || (
        !hardware.key_hold(KEY_UP)
     && !hardware.key_hold(KEY_RIGHT)
     && !hardware.key_hold(KEY_DOWN)
     && !hardware.key_hold(KEY_LEFT)
     && !hardware.get_mlh() ))) {
        draw_required = false;
        int clock     = Help::timer_ticks;
        // clear_screen_rectangle() is not enough to prevent drag remainders
        map.clear_to_color(color[COL_PINK]);
        for (int type = Object::TERRAIN; type != Object::MAX; ++type)
         for (GraIt i =  object[Object::perm(type)].begin();
                    i != object[Object::perm(type)].end(); ++i)
                        i->draw_with_trigger_area();
        clock = Help::timer_ticks - clock;
        if (clock < Help::timer_ticks_per_second / 5) draw_dragging = true;
        else                                          draw_dragging = false;
    }

    draw_selection_borders();

    // Write numbers onto hatches and goals
    GraIt    i;
    unsigned n;
    for (n = 0, i =  object[Object::GOAL] .begin();
                i != object[Object::GOAL] .end(); ++i)
     draw_object_with_numbers(i, ++n, object[Object::GOAL] .size());
    for (n = 0, i =  object[Object::HATCH].begin();
                i != object[Object::HATCH].end(); ++i)
     draw_object_with_numbers(i, ++n, object[Object::HATCH].size());

    if (browser_bitmap) {
        // the browser is so large that it covers the status bar
        bar.hide();
    }
    else {
        bar.show();
        bar.set_down(false); // it's managed by Api::Manager and thus calced
        update_bar_text();
    }
    Api::Manager::draw();

    // Mouse cursor on top
    // The mouse positioning code is here as well, as Editor::calc_self()
    // is skipped whenever a sub-window is open.
    mouse_cursor.set_x(hardware.get_mx()-mouse_cursor_offset);
    mouse_cursor.set_y(hardware.get_my()-mouse_cursor_offset);
    mouse_cursor.draw();

    pre_screen->clear_to_color(bg_color);

    // Draw everything to pre_screen
    map       .draw(*pre_screen);
    map_frames.draw(*pre_screen);
    Api::Manager::draw_to_pre_screen();
    blit_to_screen(pre_screen->get_al_bitmap());
}