예제 #1
0
int16_t wgetkey (vptype *vp, int16_t x, int16_t y, int16_t font) {
	char tempstr[2];
	int16_t oldclock;
	tempstr [1]=0;

	while (!k_pressed()) {
		oldclock=getclock();
		do {} while (oldclock==getclock());
		cursorchar=(cursorchar&7)+1;
		tempstr[0]=cursorchar;
		wprint (vp,x,y,font,tempstr);
		};
	wprint (vp,x,y,font," ");
	return (k_read());
	};
예제 #2
0
cev_move_dialog::cev_move_dialog(QString old_osp, QString projectPath, QString currentMapName)
{
    old_osp.remove( 0,5 ); // remove "move,"
    old_osp.remove( old_osp.count()-1,1 ); // remove "|"
    QStringList args = old_osp.split( "," );

    //* 1 gui
    this->type_hero_radbtn = new QRadioButton( tr( "Move a player:" ) );
    this->hero_box = new QComboBox();
    this->hero_box->addItem( tr( "Player 1" ) );
    this->hero_box->addItem( tr( "Player 2" ) );
    this->type_event_radbtn = new QRadioButton( tr( "Move an event:" ) );
    this->event_box = new QComboBox();
    this->event_box->addItems( cev_api::getMapEventNames( projectPath, currentMapName) );
    this->wait_till_done_ckbx = new QCheckBox( tr( "Pause this event till the movement is done" ) );
    this->transition_time_spin = new QSpinBox();
    this->transition_time_spin->setMaximum( 99999 );
    this->transition_time_spin->setSingleStep( 100 );
    this->transition_time_label = new QLabel( tr( "Transition time (msec):" ) );
    this->route_listWidget = new QListWidget();
    this->route_preview_widget = new croute_preview_widget( projectPath, currentMapName );
    this->btnz = new cdialogBtnzBox();
    QObject::connect( this->btnz, SIGNAL(accepted()),
                      this, SLOT(accept()) );
    QObject::connect( this->btnz, SIGNAL(rejected()),
                      this, SLOT(reject()) );

    this->remove_route_entry_btn = new QPushButton( QIcon( ":/resources/img/remove.png" ), tr( "Remove" ) );
    QObject::connect( this->remove_route_entry_btn, SIGNAL(clicked()),
                      this, SLOT(remove_entry_pressed()) );
    QObject::connect( this->route_listWidget, SIGNAL(clicked(QModelIndex)),
                      this, SLOT(enable_delete_btn()) );
    this->move_up_btn = new QPushButton( QIcon( ":/resources/img/token_passable_2_top.png" ), tr( "Move Up" ) );
    this->move_right_btn = new QPushButton( QIcon( ":/resources/img/token_passable_5_right.png" ), tr( "Move Right" ) );
    this->move_down_btn = new QPushButton( QIcon( ":/resources/img/token_passable_4_down.png" ), tr( "Move Down" ) );
    this->move_left_btn = new QPushButton( QIcon( ":/resources/img/token_passable_3_left.png" ), tr( "Move Left" ) );

    this->move_jump_start_btn = new QPushButton( QIcon( ":/resources/img/move_overlay_jmp_start.png" ), tr( "Start Jump" ) );
    this->move_jump_end_btn = new QPushButton( QIcon( ":/resources/img/move_overlay_jmp_end.png" ), tr( "End Jump" ) );
    this->move_ghost_mode_start_btn = new QPushButton( QIcon( ":/resources/img/move_overlay_ghost_mode_start.png" ), tr( "Start Ghost-Mode" ) );
    this->move_ghost_mode_end_btn = new QPushButton( QIcon( ":/resources/img/move_overlay_ghost_mode_end.png" ), tr( "End Ghost-Mode" ) );

    QObject::connect( this->move_up_btn, SIGNAL(clicked()),
                      this, SLOT(u_pressed()) );
    QObject::connect( this->move_right_btn, SIGNAL(clicked()),
                      this, SLOT(r_pressed()) );
    QObject::connect( this->move_down_btn, SIGNAL(clicked()),
                      this, SLOT(d_pressed()) );
    QObject::connect( this->move_left_btn, SIGNAL(clicked()),
                      this, SLOT(l_pressed()) );

    QObject::connect( this->move_jump_start_btn, SIGNAL(clicked()),
                      this, SLOT(j_pressed()) );
    QObject::connect( this->move_jump_end_btn, SIGNAL(clicked()),
                      this, SLOT(k_pressed()) );
    QObject::connect( this->move_ghost_mode_start_btn, SIGNAL(clicked()),
                      this, SLOT(g_pressed()) );
    QObject::connect( this->move_ghost_mode_end_btn, SIGNAL(clicked()),
                      this, SLOT(n_pressed()) );

    QGroupBox* gb_list = new QGroupBox( tr( "Movement list" ) );
    QLabel* list_label = new QLabel( tr( "Select an item to append an entry after it or to remove it." ) );
    list_label->setWordWrap( true );
    QVBoxLayout* vb = new QVBoxLayout();
    vb->addWidget( list_label );
    vb->addWidget( this->route_listWidget );
    vb->addWidget( this->remove_route_entry_btn );
    gb_list->setLayout( vb );

    QGroupBox* gb_options = new QGroupBox( tr( "Options" ) );
    gb_options->setObjectName( "gb_options" );
    QGridLayout* gl = new QGridLayout();
    gl->addWidget( this->type_hero_radbtn,      0,0,1,2 );
    gl->addWidget( this->hero_box,              1,0,1,2 );
    gl->addWidget( this->type_event_radbtn,      2,0,1,2 );
    gl->addWidget( this->event_box,             3,0,1,2 );
    gl->addWidget( this->wait_till_done_ckbx,   4,0,1,2 );
    gl->addWidget( this->transition_time_label, 5,0,1,1 );
    gl->addWidget( this->transition_time_spin,  5,1,1,1 );
    gb_options->setLayout( gl );

    QGroupBox* gb_controls = new QGroupBox( tr( "Controls" ) );
    QGridLayout* vbc = new QGridLayout();
    vbc->setContentsMargins( 3,3,3,3 );
    vbc->addWidget( this->move_up_btn,              0,0,1,1 );
    vbc->addWidget( this->move_right_btn,           0,1,1,1 );
    vbc->addWidget( this->move_down_btn,            1,0,1,1 );
    vbc->addWidget( this->move_left_btn,            1,1,1,1 );
    vbc->addWidget( this->move_jump_start_btn,      2,0,1,1 );
    vbc->addWidget( this->move_jump_end_btn,        2,1,1,1 );
    vbc->addWidget( this->move_ghost_mode_start_btn,3,0,1,1 );
    vbc->addWidget( this->move_ghost_mode_end_btn,  3,1,1,1 );
    gb_controls->setLayout( vbc );

    QGroupBox* gb_preview = new QGroupBox( tr( "Preview" ) );
    QScrollArea* scroll_area = new QScrollArea();
    QLabel* prev_label = new QLabel( tr( "Click on a tile to see a preview route from that position that will be went." ) );
    prev_label->setWordWrap( true );
    prev_label->setAlignment( Qt::AlignCenter );
    scroll_area->setWidget( this->route_preview_widget );
    QVBoxLayout* vb2 = new QVBoxLayout();
    vb2->addWidget( prev_label );
    vb2->addWidget( scroll_area );
    gb_preview->setLayout( vb2 );


    QGridLayout* gl_main = new QGridLayout();
    gl_main->addWidget( gb_list,        0,0,2,1 );
    gl_main->addWidget( gb_controls,    0,1,1,1 );
    gl_main->addWidget( gb_options,     1,1,1,1 );
    gl_main->addWidget( gb_preview,     0,2,2,1 );
    gl_main->addWidget( this->btnz,     2,0,1,3 );
    this->setLayout( gl_main );
    this->setWindowTitle( tr( "Move - dialog" ) );

    //* 2 load osp
    if ( args.at(0).contains( "event" ) )
    {
        args[0].remove( "event" );
        this->type_event_radbtn->setChecked( true );
        this->event_box->setCurrentIndex( args[0].toInt() );
    }
    else
    {
        args[0].remove( "player" );
        this->type_hero_radbtn->setChecked( true );
        this->hero_box->setCurrentIndex( args[0].toInt()-1 );
    }
    if ( args.at(1) == "1" )
        this->wait_till_done_ckbx->setChecked( true );
    else
        this->wait_till_done_ckbx->setChecked( false );
    this->transition_time_spin->setValue( args.at(2).toInt() );
    this->model_route = args.at(3);
    this->refresh_preview_and_list();
    this->remove_route_entry_btn->setEnabled( false );
}