Пример #1
0
  bool step(const float delta_time)
  {
    task_.step(delta_time);
    
    u_char key_inp = env_.keyinp->get();
    if (key_inp != '\0')
    {
      static const u_char tbl[] = {
        '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c',
        'd', 'e'
      };
      int i;
      for (i = 0; i < elemsof(tbl); ++i)
      {
        if (tbl[i] == key_inp) break;
      }
    
      if (i < elemsof(tbl))
      {
        env_.earth_texture = i;
        earth_.texture(env_.earth_texture);
      }

      if (key_inp == 'r')
      {
        rotate_mix_ = !rotate_mix_;
        env_.task->sendMsgAll(rotate_mix_ ? MSG_CONTROL_MIX : MSG_CONTROL_XY);
      }
    }
    // 地球のテクスチャを変更する

    // 問題と回答を表示するテスト
    if (key_inp == 'q' || key_inp == 'w')
    {
      if (key_inp == 'w')
      {
        --place_index_;
        if (place_index_ < 0) place_index_ = place_names_.size() - 1;
      }

      DOUT << *place_names_[place_index_] << ":" << place_index_ << "(" << place_names_.size() << ")" << std::endl;
      
      picojson::object place = places_[*place_names_[place_index_]].get<picojson::object>();
      env_.cur_place = place["name"].get<std::string>();
      env_.answer = place["answer"].is<std::string>();
      if (env_.answer) env_.ans_place = place["answer"].get<std::string>();
      env_.onetime = place["onetime"].is<bool>() ? place["onetime"].get<bool>() : false;

      if (key_inp == 'q')
      {
        place_index_ = (place_index_ + 1) % place_names_.size();
      }

      {
        std::string& f = place["file"].get<std::string>();
        std::string path = *(env_.path) + "devdata/place/" + f;

        place_ = std::tr1::shared_ptr<Place>(new Place(path));
        
        std::vector<Vec2<float> > center;
        place_->center(center);                       // 各範囲の中心を求める
        env_.place_center.clear();
        for(std::vector<Vec2<float> >::iterator it = center.begin(); it != center.end(); ++it)
        {
          Vec3<float> pos = locToPos(*it);
          env_.place_center.push_back(pos);
        }
        this->ansDisp();
      }
      // 問題の正解位置を表示

      env_.task->sendMsgAll(MSG_GAME_PLACEDISP_START);
      if (env_.answer) env_.task->sendMsgAll(MSG_GAME_PLACEDISP_ANS);
      env_.task->sendMsgAll(MSG_GAME_TOUCH_DISP);
    }
    else
    if (key_inp == 'E')
    {
      localize_.reload("en.lang");
      DOUT << "Localize:en.lang" << std::endl;
      // 強制的に英語モード
    }
    else
    if (key_inp == 'J')
    {
      localize_.reload("jp.lang");
      DOUT << "Localize:jp.lang" << std::endl;
      // 強制的に日本語モード
    }
    else
    if (key_inp == 'Z')
    {
      earth_.airDraw();
    }
    else
    if (key_inp == 'X')
    {
      earth_.bodyDraw();
    }
    else
    if (key_inp == 'C')
    {
      earth_.cloudshadowDraw();
    }
    else
    if (key_inp == 'V')
    {
      earth_.cloudbodyDraw();
    }
    else
    if (key_inp == 'B')
    {
      earth_.atmosbodyDraw();
    }
    
    return true;
  }