void pause_acceuil(){ int continuer = 1; SDL_Event event; while (continuer) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: continuer = 0; break; case SDL_MOUSEBUTTONUP:{ int xm=event.button.x,ym=event.button.y; if(xm<=470 && xm>=350 && ym<=170 && ym>=130){ SDL_FillRect(_ecran,NULL,SDL_MapRGB(_ecran->format,0,0,0)); init_stage(stage); continuer=0; }else if(xm<=550 && xm>=347 && ym<=232 && ym>=194){ pause_instructions(); }else if(xm<=493 && xm>=346 && ym<=284 && ym>=243){ exit(0); } break; } } } }
int main() { init_stage(); setup_stage(); main_loop(); cleanup(); return 0; }
static av_cold int init_processing_chain(AVFilterContext *ctx, int in_width, int in_height, int out_width, int out_height) { CUDAScaleContext *s = ctx->priv; AVHWFramesContext *in_frames_ctx; enum AVPixelFormat in_format; enum AVPixelFormat out_format; int ret; /* check that we have a hw context */ if (!ctx->inputs[0]->hw_frames_ctx) { av_log(ctx, AV_LOG_ERROR, "No hw context provided on input\n"); return AVERROR(EINVAL); } in_frames_ctx = (AVHWFramesContext*)ctx->inputs[0]->hw_frames_ctx->data; in_format = in_frames_ctx->sw_format; out_format = (s->format == AV_PIX_FMT_NONE) ? in_format : s->format; if (!format_is_supported(in_format)) { av_log(ctx, AV_LOG_ERROR, "Unsupported input format: %s\n", av_get_pix_fmt_name(in_format)); return AVERROR(ENOSYS); } if (!format_is_supported(out_format)) { av_log(ctx, AV_LOG_ERROR, "Unsupported output format: %s\n", av_get_pix_fmt_name(out_format)); return AVERROR(ENOSYS); } if (in_width == out_width && in_height == out_height) s->passthrough = 1; s->in_fmt = in_format; s->out_fmt = out_format; s->planes_in[0].width = in_width; s->planes_in[0].height = in_height; s->planes_out[0].width = out_width; s->planes_out[0].height = out_height; ret = init_stage(s, in_frames_ctx->device_ref); if (ret < 0) return ret; ctx->outputs[0]->hw_frames_ctx = av_buffer_ref(s->frames_ctx); if (!ctx->outputs[0]->hw_frames_ctx) return AVERROR(ENOMEM); return 0; }
static inline void init_head_stage(struct ipipe_domain *ipd) { struct ipipe_percpu_domain_data *p; int cpu; /* Must be set first, used in ipipe_percpu_context(). */ ipd->context_offset = offsetof(struct ipipe_percpu_data, head); for_each_online_cpu(cpu) { p = ipipe_percpu_context(ipd, cpu); memset(p, 0, sizeof(*p)); p->domain = ipd; } init_stage(ipd); }
void __init __ipipe_init_early(void) { struct ipipe_domain *ipd = &ipipe_root; int cpu; fixup_percpu_data(); /* * Do the early init stuff. At this point, the kernel does not * provide much services yet: be careful. */ __ipipe_check_platform(); /* Do platform dependent checks first. */ /* * A lightweight registration code for the root domain. We are * running on the boot CPU, hw interrupts are off, and * secondary CPUs are still lost in space. */ ipd->name = "Linux"; ipd->context_offset = root_context_offset(); init_stage(ipd); __ipipe_init_platform(); #ifdef CONFIG_PRINTK __ipipe_printk_virq = ipipe_alloc_virq(); ipd->irqs[__ipipe_printk_virq].handler = __ipipe_flush_printk; ipd->irqs[__ipipe_printk_virq].cookie = NULL; ipd->irqs[__ipipe_printk_virq].ackfn = NULL; ipd->irqs[__ipipe_printk_virq].control = IPIPE_HANDLE_MASK; #endif /* CONFIG_PRINTK */ __ipipe_work_virq = ipipe_alloc_virq(); ipd->irqs[__ipipe_work_virq].handler = __ipipe_do_work; ipd->irqs[__ipipe_work_virq].cookie = NULL; ipd->irqs[__ipipe_work_virq].ackfn = NULL; ipd->irqs[__ipipe_work_virq].control = IPIPE_HANDLE_MASK; for_each_possible_cpu(cpu) per_cpu(work_tail, cpu) = per_cpu(work_buf, cpu); }
//-------------------------------------------------------------------------- void Omu_Integrator::init_stage(int k, const Omu_VariableVec &x, const Omu_VariableVec &u, const Omu_DependentVec &Ft, bool sa) { if (k >= _K) { m_error(E_INTERN, "Omu_Integrator::init_stage" " that was called with wrong integrator setup"); } // initialize dimensions init_dims(k, x, u, Ft); _sa = sa; if ((int)(_Fcs[k]->dim) != _n) { m_error(E_INTERN, "Omu_Integrator::solve" " that was called with wrong integrator setup of stage"); } // initialize call arguments for sys->continuous _ut.resize(_nu); _dxt.resize(_nxt, _nx, _nu); v_zero(_dxt); // zero time derivative of discrete states // initialize call arguments for high-level integrator interface _xc.resize(_n, 0, 0, _nq); _dxc.resize(_n, 0, 0, _nq); _q.resize(_nq); // call high-level init init(k, _xc, _q, _Fcs[k], sa); // call depreciated init_stage init_stage(k, (Omu_SVarVec &)x, u, sa); }
//pause_jouer() void pause_jouer(){ int continuer = 1; int suivre=0; int debug=0; int posee=0; Point premier_clique={0,0}; Point precedent_motion={0,0}; Point actuel_motion={0,0}; SDL_Rect pos; SDL_Event event; while (continuer) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: continuer = 0; exit(0); break; case SDL_KEYDOWN: if(event.key.keysym.sym==SDLK_a){continuer=0;exit(0);} else if(event.key.keysym.sym==SDLK_d){test();} if(event.key.keysym.sym==SDLK_u){ pieces=lire_solution(7); actualiser_ecran(); } break; case SDL_MOUSEBUTTONUP: premier_clique.x=event.button.x; premier_clique.y=event.button.y; if(event.button.button==SDL_BUTTON_LEFT){ //menu if(premier_clique.x<=102 && premier_clique.x>=5 && premier_clique.y<=39){ if(stage<nbr_stages) stage++; else stage=1; init_stage(stage); } if(premier_clique.x<=208 && premier_clique.x>=114 && premier_clique.y<=39){ Piece* sol=lire_solution(stage); if(sol) pieces=sol; actualiser_ecran(); } if(premier_clique.x<=312 && premier_clique.x>=216 && premier_clique.y<=39){ acceuil(); } if(premier_clique.x<=419 && premier_clique.x>=324 && premier_clique.y<=39){ exit(0); } //movements if(!suivre){ puts("........Transporter........"); piece_mobile=transporter(event.button.x,event.button.y); if(piece_mobile!=NULL){ suivre=1; if(premier_clique.x<TABLE_WIDTH) dans_table=1;else dans_table=0; } actualiser_ecran(); }else{ puts("........Poser........."); posee=poser(piece_mobile,event.button.x,event.button.y); if(posee){ piece_mobile=NULL; dans_table=0; actualiser_ecran(); suivre=0; } } puts("........................................"); } else if(event.button.button=SDL_BUTTON_RIGHT){ if(suivre){ puts(".....rotating...."); Point centre={event.button.x,event.button.y}; rotate_forme(piece_mobile->forme,centre); actualiser_ecran(); } } break; case SDL_MOUSEMOTION: int xm=event.motion.x,ym=event.motion.y; actuel_motion.x=xm; actuel_motion.y=ym; if(xm<TABLE_WIDTH) dans_table=1; else dans_table=0; if(suivre){ if(piece_mobile==NULL){ puts("probleme dans l'operation de glissage"); exit(0); } translater_forme(piece_mobile->forme,precedent_motion,actuel_motion); actualiser_ecran(); }else{ dans_table=0; } precedent_motion.x=xm; precedent_motion.y=ym; } if(nbr_pieces_posees==7){ if(!mode_devel) { if(stage<nbr_stages) stage++; else stage=1; init_stage(stage); continuer=0; } } } }