コード例 #1
0
void run_game(){
/* THE GAME RUNS WITHIN THIS TRUE WHILE LOOP */
	while (!0)
    {
    while(speed_limit > 0)
    {
         speed_limit --;
    /*============================================*/
        draw_court();               // GAME STEP 1
        show_mouse(court);
        set_mouse_range(0,0,court->w,court->h);
       	check_keyboard_entry();     // GAME STEP 2
    	control_bats();             // GAME STEP 3
        check_collision();          // GAME STEP 4
        update_cock_position();     // GAME STEP 5
		
        draw_bats_and_cock();       // GAME STEP 6
        draw_speed_meter();         // GAME STEP 7
        display_game_status();      // GAME STEP 8
        draw_buffer();              // GAME STEP 9
    /*============================================*/
    }
    // Speed limiting loop ends
    }
    deinitialize_game();
}
コード例 #2
0
ファイル: mouse.c プロジェクト: AntonLanghoff/whitecatlib
/* set_mouse_etc:
 *  Hook for setting up the motion range, cursor graphic, etc, called by
 *  the mouse init and whenever we change the graphics mode.
 */
static void set_mouse_etc(void)
{
   if ((!mouse_driver) || (!gfx_driver))
      return;

   if ((!_mouse_pointer) || 
       ((screen) && (_mouse_pointer) &&
	(bitmap_color_depth(_mouse_pointer) != bitmap_color_depth(screen))))
      set_mouse_sprite(NULL);
   else
      hw_cursor_dirty = TRUE;

   set_mouse_range(0, 0, SCREEN_W-1, SCREEN_H-1);
   set_mouse_speed(2, 2);
   position_mouse(SCREEN_W/2, SCREEN_H/2);
}
コード例 #3
0
ファイル: mouse.c プロジェクト: 1007650105/aseprite
/* set_mouse_etc:
 *  Hook for setting up the motion range, cursor graphic, etc, called by
 *  the mouse init and whenever we change the graphics mode.
 */
static void set_mouse_etc(void)
{
   if ((!mouse_driver) || (!gfx_driver))
      return;

   if ((!_mouse_pointer) ||
       ((screen) && (_mouse_pointer) &&
        (bitmap_color_depth(_mouse_pointer) != bitmap_color_depth(screen))))
      set_mouse_sprite(NULL);
   else
      hw_cursor_dirty = TRUE;

   set_mouse_range(0, 0, SCREEN_W-1, SCREEN_H-1);
   set_mouse_speed(2, 2);

   /* As now we support window resizing, it's not recommended to change the mouse position. */
   /*position_mouse(SCREEN_W/2, SCREEN_H/2);*/
}
コード例 #4
0
ファイル: msdos.cpp プロジェクト: alesegdia/snes-sdk
void S9xGraphicsMode ()
{
    if (in_text_mode)
    {
	if (mode < 0)
	{
	    if (Settings.SixteenBit)
	    {
		if (Settings.SupportHiRes || interpolate)
		    mode = 10;
		else
		    mode = 9;
	    }
	    else
	    {
		if (Settings.SupportHiRes)
		    mode = 3;
		else
		    mode = 2;
	    }
	}

	int ret;
	do
	{
	    screen_width = modes [mode].width;
	    screen_height = modes [mode].height;

	    set_color_depth (Settings.SixteenBit ? 16: 8);
	    if (modes [mode].mode == GFX_VGA)
		ret = set_gfx_mode (modes [mode].mode, 320, 200, 0, 0);
	    else
		ret = set_gfx_mode (modes [mode].mode, modes [mode].width,
				    modes [mode].height, 0, 0);
	} while (ret < 0 && ++mode < COUNT(modes));

	planar = modes [mode].mode == GFX_MODEX;
	    
	if (ret < 0)
	{
	    fprintf (stderr, "Unable to switch to requested screen mode/resolution:\n%s\n",
		    allegro_error);
	    S9xExit ();
	}

	if (modes [mode].mode == GFX_VGA && screen_width == 256)
	{
	    outRegArray (scr256x256, sizeof (scr256x256) / sizeof (Register));
	    screen->w = screen->cr = 256;
	    screen->h = screen->cb = 256;
	    for (int i = 1; i < 256; i++)
		screen->line[i] = screen->line[i - 1] + 256;
	}

	clear_to_color (screen, 0);
    
	if (install_keyboard ())
	{
	    set_gfx_mode (GFX_TEXT, 0, 0, 0, 0);
	    fprintf (stdout, "Keyboard initialisation failed.\n");
	    S9xExit ();
	}
	if (!install_mouse ())
	{
	    mouse_installed = TRUE;
	    set_mouse_range (0, 0, screen_width, screen_height);
	    position_mouse (screen_width / 2, screen_height / 2);
	    prev_mouse_x = mouse_x;
	    prev_mouse_y = mouse_y;
	}
	else
	    mouse_installed = FALSE;
	in_text_mode = FALSE;
    }
}
コード例 #5
0
int mini_faders_panel_core(int xmf, int ymf, int larg)
{

if(mouse_y>ymf && mouse_y<ymf+20 )
{

if(mouse_x>xmf+(24*larg)+10 && mouse_x<xmf+(24*larg)+30)
{
if( Midi_Faders_Affectation_Type!=0)
{
 attribute_midi_solo_affectation(774,1);
}
else
{
position_minifader_selected--;
if(position_minifader_selected<0){position_minifader_selected=core_user_define_nb_faders;}
refresh_minifader_state_view_core(position_minifader_selected);
mouse_released=1;
}
}

else if(mouse_x>xmf+(24*larg)+35 && mouse_x<xmf+(24*larg)+55)
{
if(Midi_Faders_Affectation_Type!=0)
{
attribute_midi_solo_affectation(775,1);
}
else
{
position_minifader_selected++;
if(position_minifader_selected>core_user_define_nb_faders){position_minifader_selected=0;}
refresh_minifader_state_view_core(position_minifader_selected);
mouse_released=1;
}
}
}


//SELECT ALL
if(mouse_y>ymf-25 && mouse_y<ymf-5 )
{
if(mouse_x>xmf+(24*larg)+10 && mouse_x<xmf+(24*larg)+55)
{
if(Midi_Faders_Affectation_Type!=0)
{
attribute_midi_solo_affectation(145,1);
}
else
{
for(int i=0;i<core_user_define_nb_faders;i++)
{minifaders_selected[i]=1;}
}
}
}





 //select
if(mouse_x>xmf+(24*larg)+10 && mouse_x<xmf+(24*larg)+55 )
{

if(mouse_y>ymf+25 && mouse_y<ymf+45 && mouse_released==0 )
{
if( Midi_Faders_Affectation_Type!=0)
{
attribute_midi_solo_affectation(776,1);
mouse_released=1;
}
else
{
minifaders_selected[position_minifader_selected]=toggle(minifaders_selected[position_minifader_selected]);
mouse_released=1;
}
}

else if(mouse_y>ymf+50 && mouse_y<ymf+70 && mouse_released==0 )
{
if( Midi_Faders_Affectation_Type!=0)
{
 attribute_midi_solo_affectation(777,1);
 }
else
{
for(int l=0;l<core_user_define_nb_faders;l++)
{
minifaders_selected[l]=0;
}
}
mouse_released=1;
}
}

///////////////LES ACTIONS////////////////////////////////////////////////////
for(int lu=0;lu<5;lu++)
{
for(int llu=0;llu<3;llu++)
{
int numcom=(lu*3)+llu;
//mouse action:
if(mouse_x>xmf+(24*larg)+70+(lu*25) && mouse_x<xmf+(24*larg)+70+(lu*25)+20 && mouse_y>ymf+(llu*25) && mouse_y<ymf+(llu*25)+20)
{
char tmp_c[36];
switch(numcom)
{
case 0:
sprintf(tmp_c,"Flash");
break;
case 1:
sprintf(tmp_c,"Lock");
break;
case 2:
sprintf(tmp_c,"Loop");
break;
case 3:
sprintf(tmp_c,"Lfo UP");
break;
case 4:
sprintf(tmp_c,"Lfo DOWN");
break;
case 5:
sprintf(tmp_c,"Lfo SAW");
break;
case 6:
sprintf(tmp_c,"All Dock Looped");
break;
case 7:
sprintf(tmp_c,"All at 0");
break;
case 8:
sprintf(tmp_c,"Set Pos");
break;
case 9:
sprintf(tmp_c,"To Prev Dock");
break;
case 10:
sprintf(tmp_c,"To Next Dock");
break;
case 11:
sprintf(tmp_c,"Up and Down");
break;
case 12:
sprintf(tmp_c,"Sel Prev Dock");
break;
case 13:
sprintf(tmp_c,"Sel Next Dock");
break;
case 14:
sprintf(tmp_c,"Play Embedded");
break;
default:
                    strcpy(tmp_c,"");
break;
}

sprintf(string_last_midi_id,"%s is Ch: %d Pitch: %d Type: %s",tmp_c, miditable[1][778+numcom],miditable[2][778+numcom],thetypinfo);

if(numcom!=0 )// hors flash
{
if( Midi_Faders_Affectation_Type!=0)
{
 attribute_midi_solo_affectation(778+numcom,1);
 }

else
{
do_action_on_selected_minifaders(numcom);
mouse_released=1;
}
}


}



}
}

//les presets de sélections de faders//////////////////////////////////////////////////////////

for(int lg=0;lg<8;lg++)
{

if(mouse_x>xmf+(24*larg)+10 && mouse_x<xmf+(24*larg)+10+20 && mouse_y>ymf+90+(lg*25) && mouse_y<ymf+90+(lg*25)+20)
{

if(Midi_Faders_Affectation_Type!=0)
{
 //midi report
 switch(miditable[0][794+lg])
 {
  case 0:
  sprintf(thetypinfo,"Note");
  break;
  case 1:
  sprintf(thetypinfo,"Key On");
  break;
  case 2:
  sprintf(thetypinfo,"Key Off");
  break;
  case 4:
  sprintf(thetypinfo,"Ctrl Change");
  break;
 }
  sprintf(string_last_midi_id,"FaderPreset %d is Ch: %d Pitch: %d Type: %s",lg+1, miditable[1][794+lg],miditable[2][794+lg],thetypinfo);

 if(Midi_Faders_Affectation_Type==1)
 {attribute_midi_solo_affectation(794+lg,1);}
 else if(Midi_Faders_Affectation_Type==2)
 {
 attribute_midi_to_control(794, Midi_Faders_Affectation_Type,Midi_Faders_Affectation_Mode);
 }
}
else
{
if(index_do_dock==1)
{
minifader_preset_is=lg;
index_record_minifader_preset=1;
index_ask_confirm=1;
}
else if(index_main_clear==1)
{
minifader_preset_is=lg;
index_clear_minifader_preset=1;
index_ask_confirm=1;
}
else //selection souris normale
{
for(int olp=0;olp<core_user_define_nb_faders;olp++)
{minifaders_selected[olp]=minifaders_preset_selection[lg][olp];}
sprintf(string_Last_Order,"Called Fader Selection from Preset %d", lg+1);
}

}
}
}
////////////Les locks presets///////////////////////////////////////////////////

for(int lck=0;lck<8;lck++)
{

if(mouse_x>xmf+(24*larg)+35 && mouse_x<xmf+(24*larg)+35+20 && mouse_y>ymf+90+(lck*25) && mouse_y<ymf+90+(lck*25)+20)
{

if( Midi_Faders_Affectation_Type!=0)
{

     //midi report
 switch(miditable[0][605+lck])
 {
  case 0:
  sprintf(thetypinfo,"Note");
  break;
  case 1:
  sprintf(thetypinfo,"Key On");
  break;
  case 2:
  sprintf(thetypinfo,"Key Off");
  break;
  case 4:
  sprintf(thetypinfo,"Ctrl Change");
  break;
 }
  sprintf(string_last_midi_id,"Lock Preset %d is Ch: %d Pitch: %d Type: %s",lck+1, miditable[1][605+lck],miditable[2][605+lck],thetypinfo);

  if(Midi_Faders_Affectation_Type==1)
 {attribute_midi_solo_affectation(605+lck,1);}
 else if(Midi_Faders_Affectation_Type==2)
 {
 attribute_midi_to_control(605, Midi_Faders_Affectation_Type,Midi_Faders_Affectation_Mode);
 }
}

else
 {

 if(index_do_dock==1)
 {

 minifader_lockpreset_is=lck;
 index_record_minifader_lockpreset=1;
 index_ask_confirm=1;
 }

 else  if(index_main_clear==1)
 {

 reset_indexs_confirmation();
 lock_preset_selected_for_record=lck;
 index_do_clear_lock_preset=1;
 index_ask_confirm=1;
 sprintf(string_Last_Order,">> Lock State %d cleared",lck+1);
 }
 else
 {
 do_lock_preset(lck);
 sprintf(string_Last_Order,">> Lock State %d called ",lck+1);
 }
mouse_released=1;
}
}
}


/////////////////ALL AT 0///////////////////////////////////////////////////////
all_at_zero_panel_core((xmf+24*larg)+60,ymf+80);

midi_send_faders_button_logical((xmf+24*larg)+140,ymf-40,W_MINIFADERS);


////////////////////////////////////////////////////////////////////////////////
/////////////////////////LES 48 POTARDS/////////////////////////////////////////
int hmfd=200;//hauteur d une ligne de 24 faders
for(int cmptfader=0; cmptfader<max_faders/2; cmptfader++)
{
for(int lfad=0;lfad<2;lfad++)
{

if(cmptfader+(lfad*24)<=core_user_define_nb_faders-1)//limitation nbre faders
{

////FX MODE

if(  window_focus_id==922 && mouse_released==0 && mouse_x>xmf+(cmptfader*larg) && mouse_x<xmf+(cmptfader*larg)+larg && mouse_y>(ymf+(lfad*hmfd))-12  && mouse_y<(ymf+(lfad*hmfd))-12+5 )
{
if( Midi_Faders_Affectation_Type!=0)
{
attribute_midi_to_control(1543+cmptfader+(lfad*24), Midi_Faders_Affectation_Type,  Midi_Faders_Affectation_Mode);
}
else
{
  fader_mode_with_buffers[cmptfader+(lfad*24)]++;
 if(fader_mode_with_buffers[cmptfader+(lfad*24)]>5){fader_mode_with_buffers[cmptfader+(lfad*24)]=0;}
}
mouse_released=1;
}

///////////SELECTION SOURIS SUR  NUMEROS AU DESSUS FADERS/////////////////////////////////////////////////////////
if( mouse_x>xmf+(cmptfader*larg) && mouse_x<xmf+(cmptfader*larg)+larg && mouse_y>(ymf+(lfad*hmfd))  && mouse_y<(ymf+15+(lfad*hmfd)) )
{
position_minifader_selected=cmptfader+(lfad*24);

int dock_selected_is=detect_dock_used(position_minifader_selected);


//SELECTION
if(index_do_dock==0 && index_do_modify==0 && index_do_dock==0   && index_type==0    && index_main_clear==0 )
{
 minifaders_selected[position_minifader_selected]=toggle(minifaders_selected[position_minifader_selected]);
 if(index_inspekt==1)//affichage qui dans dock si VIEW activé
 {
 show_who_is_in_dock( position_minifader_selected,   detect_dock_used(position_minifader_selected));
 }
 mouse_released=1;
}


 //store normal
 else if(index_do_dock==1 && index_direct_chan==0   && index_affect_chaser_to_dock==0  && index_affect_time==0 && index_affect_color_to_dock==0 && index_do_affect_net_to_dock==0
 && index_affect_dmxin==0 && index_affect_video_tracking_to_dock==0 && index_affect_audio_to_dock==0 && gridplayer_to_affect_is==-1
 && index_do_fgroup==0 && index_affect_to_dock_mover==0 && index_affect_draw_to_dock==0 &&  index_affect_echo_to_dock==0)
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_record_on_faders=1;
 index_ask_confirm=1;
 }

  //affect time
 else if (index_do_dock==1 && index_affect_time==1 )
 {
 show_im_recording_a_time=1;
 DoTimeToDock(position_minifader_selected,dock_selected_is);
 sprintf(string_Last_Order,">>Time affected to Master %d Dock %d", position_minifader_selected+1,dock_selected_is);
 index_affect_time=0;
 }
 //color dock
 else if(index_do_dock==1 && index_affect_color_to_dock==1 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_affect_color_on_faders=1;
 index_ask_confirm=1;
 }
 //dmx to dock
 else if(index_do_dock==1 && index_affect_dmxin==1 ) // affect couleurs dans dock
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_dmx_to_dock=1;
 index_ask_confirm=1;
 }
 //artnet to dock
 else if(index_do_dock==1 && index_do_affect_net_to_dock==1 ) // affect Network IN dans dock
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_artnet_to_dock=1;
 index_ask_confirm=1;
 }
 //video to dock
 else if(index_do_dock==1 && index_affect_video_tracking_to_dock==1) // affect Network IN dans dock
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_video_to_dock=1;
 index_ask_confirm=1;
 }
 //audio to dock
 else if(index_do_dock==1 &&  index_affect_audio_to_dock==1) // affect audio controls dans dock
 {
 if(player_to_affect_to_dock>=0 && player_to_affect_to_dock<4 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_audio_to_dock=1;
 index_ask_confirm=1;
 }
 }

 //store direct CH
 else if(index_do_dock==1 && index_direct_chan==1 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_record_direct_ch=1;
 index_ask_confirm=1;
 }
 //store FX
 else if(index_do_dock==1 && index_affect_chaser_to_dock==1)
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_affect_fx=1;
 index_ask_confirm=1;
 }
 //store Grid
 else if(index_do_dock==1 &&  gridplayer_to_affect_is>=0 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_affect_grid_to_fader=1;
 index_ask_confirm=1;
 }
 //store group fader
 else if(index_do_dock==1 && index_do_fgroup==1 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 bool index_there_is_fader_selected=0;
 for(int io=0;io<48;io++)
 {
 if(minifaders_selected[io]==1){index_there_is_fader_selected=1;break;}
 }
 if(index_there_is_fader_selected==1)
 {
 index_do_affect_fgroup=1;
 index_ask_confirm=1;
 }
 else{sprintf(string_Last_Order,"No minifaders selected");}
 }

  //Store Mover dans dock
 else if (  index_do_dock==1 && index_affect_to_dock_mover==1)
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_affect_mover=1;
 index_ask_confirm=1;
 }


 //draw
 else if(index_do_dock==1 && index_affect_draw_to_dock==1)
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 draw_preset_selected_for_order=draw_preset_selected;
 index_do_draw_affect_to_dock=1;
 index_ask_confirm=1;
 mouse_released=1;
 }
  //echo
 else if(index_do_dock==1 && index_affect_echo_to_dock==1)
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_affect_echo_to_dock=1;
 index_ask_confirm=1;
 mouse_released=1;
 }

 //modify
 else if( index_do_modify==1 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_modify_on_faders=1;
 index_ask_confirm=1;
 }


  //report
 if( index_do_report==1 && index_type==0 && index_do_dock==0 && index_do_modify==0 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_report_on_faders=1;
 index_ask_confirm=1;
 sprintf(string_Last_Order,"Report");
 }

 //nommage de dock
 else if( index_type==1 && index_do_dock==0 && index_do_report==0 && index_do_modify==0   && numeric_postext!=0 )
 {
 for(int tt=0;tt<24;tt++)
 {
 DockName[position_minifader_selected][dock_selected_is][tt]=numeric[tt];
 }
 DockName[position_minifader_selected][dock_selected_is][24]='\0';
 reset_numeric_entry();numeric_postext=0;
 if(index_text_auto_close==1){index_type=0;}
 sprintf(string_Last_Order,">>On Master %d GIVED A NAME FOR DOCK %d ", position_minifader_selected+1,dock_selected_is+1);
 }

  //clear
 else if(index_main_clear==1 )
 {
 fader_selected_for_record=position_minifader_selected;
 dock_selected_for_record=dock_selected_is;
 index_do_clear_dock=1;
 index_ask_confirm=1;
 }


refresh_minifader_state_view_core(position_minifader_selected);
}

//MANIP DU MINI FADER/////////////////////////////////////////////////////////////
if( mouse_x>xmf+(cmptfader*larg) && mouse_x<xmf+(cmptfader*larg)+larg && mouse_y>(ymf+15+(lfad*hmfd))  && mouse_y<(ymf+20+127+(lfad*hmfd)) )
{

position_minifader_selected=cmptfader+(lfad*24);
refresh_minifader_state_view_core(cmptfader+(lfad*24));
if(index_inspekt==1){ //affichage qui dans dock si VIEW activé
show_who_is_in_dock( cmptfader+(lfad*24),   detect_dock_used(cmptfader+(lfad*24)));
}
set_mouse_range(xmf+(cmptfader*larg), ymf+20+(lfad*hmfd), xmf+(cmptfader*larg)+larg, ymf+20+127+(lfad*hmfd));//pour pas deborder
//click niveau fader
if( index_main_clear==0)
{
//NIVEAU
Fader[cmptfader+(lfad*24)]=((ymf+127+20+(lfad*hmfd))-mouse_y)*2;
midi_levels[cmptfader+(lfad*24)]=((ymf+127+20+(lfad*hmfd))-mouse_y);//desafffceté pour trouver pb

if(Fader[cmptfader+(lfad*24)]>=254){Fader[cmptfader+(lfad*24)]=255;midi_levels[cmptfader+(lfad*24)]=127;}

index_fader_is_manipulated[cmptfader+(lfad*24)]=1;
if(midi_send_out[cmptfader+(lfad*24)]==1){ index_send_midi_out[cmptfader+(lfad*24)]=1;}
if(lfo_mode_is[cmptfader+(lfad*24)]==1 || lfo_mode_is[cmptfader+(lfad*24)]==2 || lfo_cycle_is_on[cmptfader+(lfad*24)]==1)
{
lfo_mode_is[cmptfader+(lfad*24)]=0; lfo_mode_is[cmptfader+(lfad*24)]=0; lfo_cycle_is_on[cmptfader+(lfad*24)]=0;
}
//CONFIG MIDI

if(Midi_Faders_Affectation_Type!=0)
{
attribute_midi_to_control(cmptfader+(lfad*24), Midi_Faders_Affectation_Type,Midi_Faders_Affectation_Mode);
}
}
//NETTOYAGE DE FADER ET DOCK
if(index_main_clear==1)//clear de tous les dock du fader
{
 fader_selected_for_record=cmptfader+(lfad*24);
 index_do_clear_on_faders=1;
 index_ask_confirm=1;
 mouse_released=1  ;
}
}
}//fin limitation nb faders user define
}//fin doublage des faders
}
////////FIN DES 48 POTARDS//////////////////////////////////////////////////////

return(0);
}
コード例 #6
0
ファイル: lightgun.c プロジェクト: dafyddcrosby/meka
// Set mouse range - called in fullscreen mode only
void    LightPhaser_SetupMouseRange(bool left_most_column_masked)
{
    const int m = (left_most_column_masked ? 8 : 0);
    // Msg(MSGT_DEBUG, "ReRange %02X", ML8);
    set_mouse_range(m, 0, cur_drv->x_res - 1, cur_drv->y_res - 1);
}
コード例 #7
0
int do_logical_grand_master(int GMX, int GMY, int larg)
{

    if(mouse_x>GMX && mouse_x<GMX+larg && mouse_y>=GMY-5 && mouse_y<=GMY+255)
    {


        if((window_focus_id==0 || window_focus_id==906 )&& mouse_button==1 && index_allow_grand_master==1)
        {
            set_mouse_range(GMX, GMY, GMX+larg, GMY+255);//pour pas deborder
//NIVEAU
            niveauGMaster=((GMY+255)-mouse_y);
            if(niveauGMaster>255) {
                niveauGMaster=255;
            }
            if(niveauGMaster<0) {
                niveauGMaster=0;
            }
            midi_levels[615]=(niveauGMaster/2);
            if(midi_send_out[615]==1) {
                index_send_midi_out[615]=1;
            }

//CONFIG MIDI
            if(Midi_Faders_Affectation_Type!=0)//config midi
            {
                attribute_midi_solo_affectation(615,Midi_Faders_Affectation_Mode);

//midi report
                switch(miditable[0][615])
                {
                case 0:
                    sprintf(thetypinfo,"Note");
                    break;
                case 1:
                    sprintf(thetypinfo,"Key On");
                    break;
                case 2:
                    sprintf(thetypinfo,"Key Off");
                    break;
                case 4:
                    sprintf(thetypinfo,"Ctrl Change");
                    break;
                }
                sprintf(string_last_midi_id,"MIDI GRAND MASTER:Ch: %d Pitch: %d Type: %s", miditable[1][615],miditable[2][615],thetypinfo);

                mouse_released=1;
            }
        }
    }

//midi out on off
    if(mouse_x>GMX+larg+30-10 && mouse_x<GMX+larg+30+10 && mouse_y>GMY+250-10 && mouse_y<GMY+250+10)
    {
        if(mouse_button==1 && mouse_released==0)
        {
            if(midi_send_out[615]==0) {
                midi_send_out[615]=1;
            }
            else if(midi_send_out[615]==1) {
                midi_send_out[615]=0;
            }
            mouse_released=1;
        }
    }

//raccrochage midi
    raccrochage_midi_logical_vertical_dmx(GMX,GMY,615,larg,255);


    return(0);
}
コード例 #8
0
int do_logical_TheGrid_commands ( int xb, int yb, int num_grid_player)
{

//accélérometer du player
if(mouse_x>xb-5 && mouse_x<xb+127+5 && mouse_y>=yb+30 && mouse_y<=yb+30+10 )
{
if(Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(1508+num_grid_player,Midi_Faders_Affectation_Mode);
}
else
{
 if(grid_player_slave[num_grid_player]==0)
 {
  set_mouse_range(xb-5,yb+30,xb+127+5,yb+30+10);
  grid_crossfade_speed[num_grid_player]=mouse_x-xb;
  if(grid_crossfade_speed[num_grid_player]<0){grid_crossfade_speed[num_grid_player]=0;}
  else  if(grid_crossfade_speed[num_grid_player]>127){grid_crossfade_speed[num_grid_player]=127;}
  //integration gridplayer 1 au sequenciel
  if(index_link_speed_crossfade_to_gpl1==1 && num_grid_player==0)
  {
   grid_crossfade_speed[0]=crossfade_speed;
   midi_levels[1508]=crossfade_speed;
  }
  gridder_prepare_cross(num_grid_player,index_grider_selected[num_grid_player],index_grider_step_is[num_grid_player]);
 }
}
}

////////////////SLAVE MODE////////////////////////////////////////////////////
if(mouse_x>xb+150 && mouse_x<xb+150+40 && mouse_y>yb+25 && mouse_y<yb+25+15)
{
if(mouse_released==0)
{
if(Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(1504+num_grid_player,Midi_Faders_Affectation_Mode);
}
else
{
grid_player_slave[num_grid_player]=toggle(grid_player_slave[num_grid_player]);
}
mouse_released=1;
}
}




for(int sp=0;sp<4;sp++)
{
if( mouse_x>xb && mouse_x<xb+10 && mouse_y>yb+70+(sp*20) && mouse_y<yb+70+(sp*20)+10 )
{
if( mouse_released==0 )
{
 if( Midi_Faders_Affectation_Type!=0)
 {
 attribute_midi_solo_affectation(1512+(sp*4)+num_grid_player,Midi_Faders_Affectation_Mode);
 }
 else
 {
 switch(sp)
 {
 case 0:
 grider_goto_mode[num_grid_player]=toggle(grider_goto_mode[num_grid_player]);
 break;
 case 1:
 grider_count_mode[num_grid_player]=toggle(grider_count_mode[num_grid_player]);
 break;
 case 2:
 grider_seekto_mode[num_grid_player]=toggle(grider_seekto_mode[num_grid_player]);
 break;
 case 3:
 grider_stoplay_mode[num_grid_player]=toggle(grider_stoplay_mode[num_grid_player]);
 break;
 default:
 break;
 }
 }
 mouse_released=1;
}
}
}//fin boucle4

//Goto Grid num
if( index_enable_edit_Grider==1  && mouse_x>xb+105 && mouse_x<xb+105+30 && mouse_y>yb+70 && mouse_y<yb+70+15 )
{
 if(  mouse_released==0 )
 {
 grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][0]=atoi(numeric)-1;
 if(grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][0]<0)
 {grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][0]=-1;}//désaffectation
 if(grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][0]>127)
 {grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][0]=127;}
 reset_numeric_entry();
 mouse_released=1;
 }
}
//Goto step num
if(index_enable_edit_Grider==1  &&  mouse_x>xb+150 && mouse_x<xb+150+40 && mouse_y>yb+70 && mouse_y<yb+70+15 )
{
if( mouse_released==0)
 {
  grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][1]=atoi(numeric)-1;
 if(grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][1]<0)
 {grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][1]=-1;}//désaffectation
 if(grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][1]>1023)
 {grid_goto[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]][1]=1023;}
 reset_numeric_entry();
 mouse_released=1;
 }
}

//count num
if( index_enable_edit_Grider==1  && mouse_x>xb+150 && mouse_x<xb+150+40 && mouse_y>yb+90 && mouse_y<yb+90+15  )
{
if( mouse_released==0)
 {
 grid_count[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]=atoi(numeric);
 if(grid_count[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]<0)
 {
 grid_count[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]=0;
 }
 reset_numeric_entry();
 mouse_released=1;
 }
}


//Seek step num
if( index_enable_edit_Grider==1  && mouse_x>xb+150 && mouse_x<xb+150+40 && mouse_y>yb+110 && mouse_y<yb+110+15  )
{
if( mouse_released==0)
 {
  grid_seekpos[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]=atoi(numeric)-1;
 if(grid_seekpos[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]<0)
 {grid_seekpos[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]=-1;}//désaffectation
 if(grid_seekpos[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]>1023)
 {grid_seekpos[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]=1023;}
 reset_numeric_entry();
 mouse_released=1;
 }
}

//Stoplay button
if( index_enable_edit_Grider==1  && mouse_x>xb+100 && mouse_x<xb+100+90 && mouse_y>yb+130 && mouse_y<yb+130+15 && mouse_b&1 && mouse_released==0)
{
 grid_stoplay[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]=toggle(grid_stoplay[index_grider_selected[num_grid_player]][index_grider_step_is[num_grid_player]]);
 mouse_released=1;
}
return(0);
}
コード例 #9
0
int do_logical_x1_x2(int x_seq,int y_seq)
{

/////////////////////////////////////CROSSFADE MANUEL/////////////////////////////

if(mouse_y>=y_seq+60 && mouse_y<=y_seq+100+255)//-20 +20
{
///////////////////X///////////////////////////////////////////////////////////
if(mouse_x> x_seq+480 && mouse_x< x_seq+480+45)
{


switch(miditable[0][491])
{
//midi report
case 0:
sprintf(thetypinfo,"Note");
break;
case 1:
sprintf(thetypinfo,"Key On");
break;
case 2:
sprintf(thetypinfo,"Key Off");
break;
case 4:
sprintf(thetypinfo,"Ctrl Change");
break;
}
sprintf(string_last_midi_id,"STAGE Fader is Ch: %d Pitch: %d Typ: %s" , miditable[1][491],miditable[2][491],thetypinfo);
if( Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(491,Midi_Faders_Affectation_Mode);
mouse_released=1;
}
else
{
set_mouse_range(x_seq+480, y_seq+60, x_seq+480+45, y_seq+100+255);//pour pas deborder
index_go=0; index_go_back=0; index_pause=0;
niveauX1=(y_seq+80+255)-mouse_y;
if(niveauX1<0){niveauX1=0;}
if(niveauX1>255){niveauX1=255;}
if(midi_send_out[491]==1){index_send_midi_out[491]=1;}
if(index_x1_x2_together==1)
{
if(((255.0-ratio_X1X2_together)/255)==1.0){niveauX2=(255-niveauX1);}
else {niveauX2=remapX2[(255-niveauX1)];}
if(niveauX2<0){niveauX2=0;}
if(niveauX2>255){niveauX2=255;}
if(midi_send_out[492]==1){index_send_midi_out[492]=1;}
}
}
}

////////////////////X2////////////////////////////////////////////////////////////////
if(mouse_x> x_seq+580 && mouse_x< x_seq+580+45)
{


//midi report
switch(miditable[0][492])
{
//midi report
case 0:
sprintf(thetypinfo,"Note");
break;
case 1:
sprintf(thetypinfo,"Key On");
break;
case 2:
sprintf(thetypinfo,"Key Off");
break;
case 4:
sprintf(thetypinfo,"Ctrl Change");
break;
}
sprintf(string_last_midi_id,"Preset Fader is Ch: %d Pitch: %d Typ: %s" , miditable[1][492],miditable[2][492],thetypinfo);
if( Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(492,Midi_Faders_Affectation_Mode);
mouse_released=1;
}
else
{
set_mouse_range(x_seq+580, y_seq+60, x_seq+580+45, y_seq+100+255);//pour pas deborder
index_go=0; index_go_back=0; index_pause=0;
niveauX2=(-1)*(mouse_y-(y_seq+80+255));
if(niveauX2<0){niveauX2=0;}
if(niveauX2>255){niveauX2=255;}
if(midi_send_out[492]==1){index_send_midi_out[492]=1;}
if(index_x1_x2_together==1)
{
if(((255.0-ratio_X1X2_together)/255)==1.0){niveauX1=(255-niveauX2);}
else { niveauX1=255-remapX1[niveauX2];     }
if(niveauX1<0){niveauX1=0;}
if(niveauX1>255){niveauX1=255;}
if (niveauX2==255){niveauX1=0;}//report à zero
if(midi_send_out[491]==1){index_send_midi_out[491]=1;}
}
}
}
if(niveauX1==0 && niveauX2==255)
{
index_go=0; index_go_back=0; index_pause=0;
next_mem_crossfade_finished(position_preset);
index_x1_x2_together=1;
mouse_released=1;
}
}


raccrochage_midi_logical_vertical_dmx ( x_seq+480, (y_seq+80), 491, 45, 255);//X1
raccrochage_midi_logical_vertical_dmx ( x_seq+580, (y_seq+80), 492, 45, 255);//X2 séparés car inversés pour l'affichage etc

//TOGETHER


if(mouse_x>  x_seq+535 && mouse_x<  x_seq+535+40 && mouse_y>=y_seq+80 && mouse_y<=y_seq+80+255)
{

ratio_X1X2_together=(int)((mouse_y)-(y_seq+80+255));

float fract_remplaX1=(255.0-ratio_X1X2_together)/255;
float remapis=255.0;
float fract_remplaX2=(255.0-ratio_X1X2_together)/255;
for(int mop=255;mop>=0;mop--)
{
remapis-=fract_remplaX1;
if (remapis>255){remapX1[mop]=255;}
else if(remapis<0){remapX1[mop]=0;}
else
{
remapX1[mop]=(int)(remapis);
}
}

for(int mop=0;mop<256;mop++)
{
remapis+=fract_remplaX2;
if (remapis>255){remapX2[mop]=255;}
else if(remapis<0){remapX2[mop]=0;}
else {remapX2[mop]=(int)(remapis);  }
}
}


if(mouse_x>  x_seq+540 && mouse_x<  x_seq+540+50 && mouse_y>y_seq+50 && mouse_y<y_seq+50+20)
{
if(index_x1_x2_together==0){index_x1_x2_together=1;}
else {index_x1_x2_together=0;}
mouse_released=1;
}




if(mouse_x>x_seq+540+14-20 && mouse_x<x_seq+540+14+20 && mouse_y>y_seq+80+255+40-20 && mouse_y<y_seq+80+255+40+20)
{


//midi report
 switch(miditable[0][495])
{
//midi report
case 0:
sprintf(thetypinfo,"Note");
break;
case 1:
sprintf(thetypinfo,"Key On");
break;
case 2:
sprintf(thetypinfo,"Key Off");
break;
case 4:
sprintf(thetypinfo,"Ctrl Change");
break;
}
sprintf(string_last_midi_id,"GO is Ch: %d Pitch: %d Typ: %s" , miditable[1][495],miditable[2][495],thetypinfo);
if(Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(495,Midi_Faders_Affectation_Mode);
mouse_released=1;
}
else
{
do_go_function();
if(index_go==1 && index_pause==0)
{
do_send_bang();
}
mouse_released=1;
}
}


//////////////go back

if(mouse_x>x_seq+490+14-20 && mouse_x<x_seq+490+14+20 && mouse_y>y_seq+80+255+40-20 && mouse_y<y_seq+80+255+40+20)
{

//midi report
switch(miditable[0][494])
{
//midi report
case 0:
sprintf(thetypinfo,"Note");
break;
case 1:
sprintf(thetypinfo,"Key On");
break;
case 2:
sprintf(thetypinfo,"Key Off");
break;
case 4:
sprintf(thetypinfo,"Ctrl Change");
break;
}
  sprintf(string_last_midi_id,"GO BACK is Ch: %d Pitch: %d Typ: %s" , miditable[1][494],miditable[2][494],thetypinfo);
if( Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(494,Midi_Faders_Affectation_Mode);
mouse_released=1;
}

else
{
do_go_back_function();
int banger_back_is=Banger_Memoire[position_preset]-1;
do_go_back_bang(banger_back_is);
mouse_released=1;
}
}


//////////////double go

if(mouse_x>x_seq+590+14-20 && mouse_x<x_seq+590+14+20 && mouse_y>y_seq+80+255+40-20 && mouse_y<y_seq+80+255+40+20)
{


//midi report
switch(miditable[0][496])
{
//midi report
case 0:
sprintf(thetypinfo,"Note");
break;
case 1:
sprintf(thetypinfo,"Key On");
break;
case 2:
sprintf(thetypinfo,"Key Off");
break;
case 4:
sprintf(thetypinfo,"Ctrl Change");
break;
}
  sprintf(string_last_midi_id,"GO BACK is Ch: %d Pitch: %d Typ: %s" , miditable[1][496],miditable[2][496],thetypinfo);
if( Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(496,Midi_Faders_Affectation_Mode);
mouse_released=1;
}

else
{
do_double_go_function();
if(index_go==1 && index_pause==0)
{
do_send_bang();
}
mouse_released=1;
}
}

/////////////////////ACCELEROMETRE

if(mouse_x>=x_seq+490 && mouse_x<=x_seq+490+127 && mouse_y>y_seq+405 && mouse_y<y_seq+405+(45/2))
{



switch(miditable[0][493])
{
//midi report
case 0:
sprintf(thetypinfo,"Note");
break;
case 1:
sprintf(thetypinfo,"Key On");
break;
case 2:
sprintf(thetypinfo,"Key Off");
break;
case 4:
sprintf(thetypinfo,"Ctrl Change");
break;
}
sprintf(string_last_midi_id,"SpeedFader is Ch: %d Pitch: %d Typ: %s" , miditable[1][493],miditable[2][493],thetypinfo);

if(Midi_Faders_Affectation_Type!=0)//config midi
{
attribute_midi_solo_affectation(493,Midi_Faders_Affectation_Mode);
mouse_released=1;
}
else
{
set_mouse_range(x_seq+490, y_seq+405, x_seq+490+127, y_seq+405+(45/2));//pour pas deborder
crossfade_speed=mouse_x-(x_seq+490);
if(crossfade_speed<0){crossfade_speed=0;}
if(crossfade_speed>127){crossfade_speed=127;}
//integration gridplayer 1
if(index_link_speed_crossfade_to_gpl1==1)
{
grid_crossfade_speed[0]=crossfade_speed;
midi_levels[1508]=crossfade_speed;
gridder_prepare_cross(0,index_grider_selected[0],index_grider_step_is[0]);
}

if(midi_send_out[493]==1){index_send_midi_out[493]=1;}
prepare_crossfade();
//ventilation_temps_vers_char();//icat
someone_changed_in_time_sequences=1;//icat
}
}

//midi out des x1 et x2

if(mouse_x> x_seq+655-10 && mouse_x<  x_seq+655+10 && mouse_y>y_seq+340-10 && mouse_y<y_seq+340+10)
{

  if(midi_send_out[491]==0){midi_send_out[491]=1; }
  else if(midi_send_out[491]==1){midi_send_out[491]=0; }
  //report pour x2 et speed crossfade
  midi_send_out[492]=midi_send_out[491];
  mouse_released=1;
}


//MIDI OUT DU SPEED

if(mouse_x> x_seq+655-10 && mouse_x<  x_seq+655+10 && mouse_y>y_seq+340-10+85 && mouse_y<y_seq+340+10+85)
{
  if(midi_send_out[493]==0){midi_send_out[493]=1; }
  else if(midi_send_out[493]==1){midi_send_out[493]=0; }
  mouse_released=1;
}

raccrochage_midi_logical_horizontal ( x_seq+490, y_seq+405, 493,127,13);

//auto reset on link
if(mouse_x> x_seq+548 && mouse_x<  x_seq+548+15 && mouse_y>y_seq+435 && mouse_y<y_seq+435+15)
{
if( Midi_Faders_Affectation_Type!=0)
{
attribute_midi_solo_affectation(1591,Midi_Faders_Affectation_Mode);
}
else
{
auto_reset_crossfade_speed_on_link=toggle(auto_reset_crossfade_speed_on_link);
}
mouse_released=1;
}
return(0);
}