Esempio n. 1
0
 void convertPlaces(const std::string& name)
 {
   Dxf dxf(path_ + "devdata/" + name);
   picojson::object& object = dxf.json().get<picojson::object>();
   for (picojson::object::iterator it = object.begin(); it != object.end(); ++it)
   {
     std::string fpath = path_ + "devdata/place/" + it->first + ".json";
     picojson::value json = picojson::value(it->second);
     std::ofstream fstr(fpath.c_str());
     if (fstr.is_open()) { fstr << json; };
   }
 }
Esempio n. 2
0
void Shader::addFragmentShader(const char *ffile)
{
	std::string fstr(ffile);
	if(fstr.size() != 0){
		m_fs = createShader(GL_FRAGMENT_SHADER,file_read(ffile));
		glAttachShader(m_Program, m_fs);
		std::cout<<"Fragment Shader \""<<fstr<<"\" Added"<<std::endl;
	}
	else{
		std::cerr<<"No Fragment Shader Detected";
	}
}
Esempio n. 3
0
char	*chstr(int ex)
{
	static char	tmp0[8];

	if(ex<1 || ex>32){
		strcpy(tmp0,"OFF");
	}else{
		tmp0[0]=((ex-1)>>4)+'A';tmp0[1]=0;
		strcat(tmp0,fstr(((ex-1)&15)+1,2));

	}
	return(tmp0);
}
	// load from file
	void Recorders::load_from_file(std::string filename) {

		std::ifstream fp(filename.c_str(), std::ios::binary);

		google::protobuf::io::IstreamInputStream fstr(&fp);
		google::protobuf::io::CodedInputStream code_input(&fstr);
		code_input.SetTotalBytesLimit((int)MAX_PROTOFILE_SIZE, (int)MAX_PROTOFILE_SIZE);

		recorder.ParseFromCodedStream(&code_input);

		fp.close();

	}
Esempio n. 5
0
// データ読み込み
// TIPS: 読み込みに失敗したら false を返す
bool data::loadUserData(const short& num) {

  // ファイルパスを取得。失敗なら処理を中断
  if (!getFilePass(num)) { return false; }

  std::ifstream fstr(file_);
  if (fstr) {

    // TIPS: ゲームの難易度を取得
    short temp;
    fstr >> temp;
    user.dif_ = dif(temp);

    // TIPS: マップデータを取得
    for (short i = 0; i < design::AllStage; ++i) {
      fstr >> user.map_info[i].flag_ >> user.map_info[i].id_;
    }

    // TIPS: クリア回数など、システムに関わるデータの取得
    fstr
      >> user.count.clear_
      >> user.count.battle_
      >> user.count.command_;

    // TIPS: 資金など、政策画面に関わるデータを取得
    fstr >> user.money_;

    // TIPS: 作戦コマンドのデータを取得
    fstr
      >> user.strategy.poison_
      >> user.strategy.fire_
      >> user.strategy.cannon_
      >> user.strategy.spy_;

    // TIPS: 作成済みのキャラクター数を取得、配列を確保する
    short num;
    fstr >> num;
    for (short i = 0; i < num; ++i) { user.player.emplace_back(); }

    // TIPS: キャラクターデータを取得
    std::vector<cCharacter>::iterator it, begin, end;
    begin = user.player.begin();
    end = user.player.end();
    for (it = begin; it != end; ++it) { it->fileLoad(fstr); }

    return true;
  }

  return false;
}
Esempio n. 6
0
int ut_AFragmentString_General(void)
{
  int iRet = 0x0;

  std::cerr << "ut_AFragmentString_General" << std::endl;

	AFragmentString fstr("foo-[1c]\\\\(4,3,1)");
	AString str;
  fstr.next(str);
	int i;
  ASSERT_UNIT_TEST(fstr.getPermutations() == 6, "AFragmentString getPermutations", "0", iRet);

  for (i=0; i<4; ++i) {
		str.clear();
    fstr.next(str);
	}
  ASSERT_UNIT_TEST(str.equals("foo-c\\0002"), "AFragmentString next", "0", iRet);

  //
	fstr.clear();
	fstr.parse("<4>");
  ASSERT_UNIT_TEST(fstr.getPermutations() == 10000, "AFragmentString getPermutations", "1", iRet);

  //
	fstr.clear();
	fstr.parse("(2)");
  ASSERT_UNIT_TEST(fstr.getPermutations() == 100, "AFragmentString getPermutations", "2", iRet);

	//
  fstr.clear();
	fstr.parse("(4,100,112,-3)");
  ASSERT_UNIT_TEST(fstr.getPermutations() == 5, "AFragmentString getPermutations", "3", iRet);
  str.clear();
	fstr.next(str);
  ASSERT_UNIT_TEST(str.equals("0112"), "AFragmentString next", "1", iRet);
	for (i=0; i<2; ++i) {
		str.clear();
    fstr.next(str);
	}
  ASSERT_UNIT_TEST(str.equals("0106"), "AFragmentString next", "2", iRet);
	for (i=0; i<2; ++i) {
		str.clear();
    fstr.next(str);
	}
  ASSERT_UNIT_TEST(str.equals("0100"), "AFragmentString next", "3", iRet);
	
	return iRet;
}
 void                      
 transformation_sequence::write ( std::string const& file ) const
 {
   try {
     std::ofstream fstr ( file.c_str(), std::ios_base::binary | std::ios_base::out );
     if ( fstr.good() )
     {
       write ( fstr );
       fstr.close();
     } else {
       throw std::runtime_error("Cannot open file.");
     }
   } catch ( std::exception& e ) {
     BOOST_LOG_TRIVIAL(error) << "transformation_sequence::write() failed. " << e.what() << std::endl;
   }
 }
Esempio n. 8
0
CString 
CPFileChunkAccess::ReadString( void )
{
        char* str;
        UInt32 length = pafreads( &str    , 
                                  _pafile );
        if ( length && str )
        {
                CString fstr( str );
                pafree( str );
                return fstr;
        }                 
        
        CString emptystr;
        return emptystr;
}
Esempio n. 9
0
_INITIALIZE_EASYLOGGINGPP

int main(void) {
    el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
    
    // These checks should fail
    LOG(INFO) << "----- DONT WORRY ABOUT FOLLOWING CHECKS FAILING - THEY ARE EXPECTED";
    CHECK(1 > 2) << "1 is not greater than 2";
    CHECK_EQ(1, 2) << "1 is not equal to 2";
    CHECK_NE(1, 1) << "Wow, I did not know 1 == 1";
    CHECK_STREQ("abc", "def") << " :)";
    CHECK_STRNE("abc", "abc") << " :(";
    CHECK_STRCASEEQ("abc", "ABCD") << " :p";
    CHECK_STRCASENE("abc", "ABC") << " B)";
    int* f = new int;
    int* toF = CHECK_NOTNULL(f);

    (void)toF; // Unused warning suppression

    delete f;
    f = nullptr;
    // These checks should pass 
    LOG(WARNING) << "----- START WORRYING ABOUT CHECKS NOW";
    CHECK(1 < 2) << " snap -- lib has bug!";
    CHECK_EQ(1, 1) << " snap -- lib has bug!";
    CHECK_NE(1, 2) << " snap -- lib has bug!";
    CHECK_STREQ("abc", "abc") << " snap -- lib has bug!";
    CHECK_STRNE("abc", "abe") << " snap -- lib has bug!";
    CHECK_STRCASEEQ("abc", "ABC") << " snap -- lib has bug!";
    CHECK_STRCASENE("abc", "ABE") << " snap -- lib has bug!";
    LOG(INFO) << "----- HOPEFULLY NO CHECK FAILED SINCE YOU STARTED WORRYING!";

    // DCHECKs
    DCHECK(1 > 2) << "1 is not greater than 2";
    DCHECK_EQ(1, 2) << "1 is not equal to 2";
    DCHECK_NE(1, 1) << "Wow, I did not know 1 == 1";
    DCHECK_STREQ("abc", "def") << " :)";
    DCHECK_STRNE("abc", "abc") << " :(";
    DCHECK_STRCASEEQ("abc", "ABCD") << " :p";
    DCHECK_STRCASENE("abc", "ABC") << " B)";
    
    // PCHECKs
    std::fstream fstr("a/file/that/does/not/exist", std::fstream::in);
    PCHECK(fstr.is_open());
    DPCHECK(fstr.is_open());
    return 0;
}
Esempio n. 10
0
int Plugin::replaceWithLink(std::string filepath)
{
    std::cout << "Replacing with link " << filepath.c_str() << std::endl;

    std::ifstream fstr(filepath.c_str());
    MD5Engine md5;
    DigestOutputStream ostr(md5);
    Poco::StreamCopier::copyStream(fstr, ostr);
    ostr.flush();
    const DigestEngine::Digest& digest = md5.digest();
    std::string sourceMd5 = DigestEngine::digestToHex(digest);
    std::cout << "File contents MD5 sum: " << sourceMd5.c_str() << std::endl;

    // Generate new file name
    UUIDGenerator gen;
    UUID tmpUuid = gen.createRandom();
    std::string uuid = tmpUuid.toString(); 
    std::string newFile(Plugin::GIT_CACHE_DIR);
    newFile.append("/");
    newFile.append(uuid);

    Process::Args args;
    args.push_back(filepath);
    args.push_back(newFile);
    Poco::ProcessHandle ph = Process::launch("mv", args, 0, 0, 0);

    // Failback with sudo
    if (ph.wait() != 0)
    {
        args.clear();
        args.push_back("mv");
        args.push_back(filepath);
        args.push_back(newFile);
        ph = Process::launch("sudo", args, 0, 0, 0);
    }

    // Check if file was moved
    File originalFile(filepath);
    if (originalFile.exists())
    {
        std::cout << "Failed to move original file" << std::endl;
        return -1;
    }

    return 1;
}
Esempio n. 11
0
File: EvSel.C Progetto: XuQiao/HI
void EvSel(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
ofstream fstr("EventSelPbP.txt");
const int Ncolor=7; const int N=5; const int NSel=9;
static const int Color[Ncolor]={
   1, 2, 4, 46,6, 7,8
};
static const int Style[Ncolor] = {
    20, 34, 33, 25,27, 28,24
};
//double vzbin[]={-30,}
//TString TrigName[N]={"Jet20","Jet40","Jet60","Jet80","Jet100","MB"};
TString TrigName[N]={"Jet20","Jet40","Jet60","Jet80","Jet100"};
//TString histoName[NSel]={"Ev","EvRun","EvRunHLT","EvRunHLTEvt","EvRunHLTEvtppr","EvRunHLTEvtpprNoi","EvRunHLTEvtpprNoivz","EvRunHLTEvtpprNoivzGps"};
TString histoName[NSel]={"Ev","EvRun","EvRunHLT","EvRunHLTBeam","EvRunHLTBeamppr","EvRunHLTBeampprHFp","EvRunHLTBeampprHFpHFn","EvRunHLTBeampprHFpHFnNoi","EvRunHLTBeampprHFpHFnNoivz"};
TString CutName[NSel]={"0. No cut","1. Run >211256\t","2. HLT_PAJet*_NoJetID_v1","3. pBeamScrapingFilter\t","4. pprimaryvertexFilter\t","5. phfPosFilter1\t","6. phfNegFilter1\t","7. pHBHENoiseFilter\t","8. |vertex.z| < 15\t"};
TFile *f[N];	TH1F* hEvSel[N][NSel];

const int Nbase=0;
fstr<<"\tCutName\t\t"<<"Number of Events"<<"\t"<<"fraction to the total\t"<<"fraction to the previous"<<endl;
for(int i=0;i<N;i++){
f[i]=TFile::Open(Form("/scratch/xuq7/RpA/GlobalEvent/EventSel/Kurtfile/PbP%sEvSel.root",TrigName[i].Data()));
fstr<<TrigName[i]<<":"<<endl;
for(int j=0;j<NSel;j++){
hEvSel[i][j]=(TH1F*)f[i]->Get(Form("h%s",histoName[j].Data()));
if(j>=Nbase){
if(j==Nbase){
if(i==N-1)
fstr<<CutName[j]<<"\t"<<setprecision(0)<<fixed<<hEvSel[i][j]->GetEntries()<<"\t\t"<<setprecision(4)<<fixed<<(double)hEvSel[i][j]->GetEntries()/hEvSel[i][Nbase]->GetEntries()*100<<"%"<<"\t\t\t"<<endl;
else
fstr<<CutName[j]<<"\t"<<setprecision(0)<<fixed<<hEvSel[i][j]->GetEntries()<<"\t\t\t"<<setprecision(4)<<fixed<<(double)hEvSel[i][j]->GetEntries()/hEvSel[i][Nbase]->GetEntries()*100<<"%"<<"\t\t\t"<<endl;
}
else
fstr<<CutName[j]<<"\t"<<setprecision(0)<<fixed<<hEvSel[i][j]->GetEntries()<<"\t\t\t"<<setprecision(4)<<fixed<<(double)hEvSel[i][j]->GetEntries()/hEvSel[i][Nbase]->GetEntries()*100<<"%"<<"\t\t\t"<<(double)hEvSel[i][j]->GetEntries()/hEvSel[i][j-1]->GetEntries()*100<<"%"<<endl;
}
else
fstr<<CutName[j]<<"\t"<<setprecision(0)<<fixed<<hEvSel[i][j]->GetEntries()<<endl;
}
fstr<<setprecision(4)<<fixed<<(double)hEvSel[i][NSel-1]->GetEntries()/hEvSel[i][2]->GetEntries()*100<<"%"<<endl;
fstr<<endl;
}


}
Esempio n. 12
0
void Parse(const std::string& rcFile, const std::string& out)
{
    std::ifstream fstr(rcFile);
    std::ofstream ostr(out);
    std::regex rexBuildNum("\\s*#define\\s*BUILD_NUM\\s*(\\d+)");
    for (std::string line; std::getline(fstr, line);)
    {
        std::smatch res;
        if (std::regex_match(line, res, rexBuildNum))
        {
            std::string incremented("#define BUILD_NUM ");
            incremented.append(std::to_string(std::stoi(res[1]) + 1));
            ostr << incremented << '\n';
        }
        else
        {
            ostr << line << '\n';
        }
    }
}
Esempio n. 13
0
/* save IQ data to disk
 */
bool Spectrum::saveError()
{
    QDir       directory;
    directory.setCurrent(userDirectory);
    QByteArray fname = "iq" + QByteArray::number(nrig) + ".dat";
    QFile      file(fname);
    if (!file.open(QIODevice::WriteOnly)) {
        return(false);
    }
    QDataStream fstr(&file);
    for (int i = 0; i < sizeIQ; i++) {
        if (calibSigList[i].n) {
            fstr << i;
            fstr << calibSigList[i].n;
            fstr << calibSigList[i].zsum[0];
            fstr << calibSigList[i].zsum[1];
        }
    }
    file.close();
    return(true);
}
Esempio n. 14
0
 void                      
 transformation_sequence::read  ( std::string const& file )
 {
   try 
   {
     if ( boost::filesystem::exists ( file ) )
     {
       std::ifstream fstr ( file.c_str(), std::ios_base::binary | std::ios_base::in );
       if ( fstr.good() )
       {
         read ( fstr );
         fstr.close();
       } else {
         throw std::runtime_error("Cannot open file.");
       }
     } else {
       throw std::runtime_error("No such file.");
     }
   } catch ( std::exception& e ) {
     BOOST_LOG_TRIVIAL(error) << "transformation_sequence::read() failed. " << e.what() << std::endl;
   }
 }
Esempio n. 15
0
engineimp::engineimp(const std::string& fname, const std::string& outname,
        const std::string& start_index):datas_queued(0), data_size(0), is_over(0),
    cur_blob(std::make_shared<data_blob>()){
        cur_blob->size=0;
        values["!out_file"] =  std::make_shared<string>();
        ((native_item*)(values["!out_file"].get()))->parse(outname);
        values["!out_file"]->setname("!out_file");
        ofile.open(outname.c_str(), std::ofstream::out | std::ofstream::trunc);
        auto p = std::make_shared<integer>();
        p->parse(start_index);
        p->setname("!start_ind");
        values["!start_ind"]=p;
        std::ifstream fstr(fname.c_str());
        if(f_is_empty(fstr)){
            err("Empty/non-existant file passed as configuration parameter",
                    "engineimp::engineimp(std::string)", "engine/engine.cpp", FATAL_ERROR);
        }
        read(fstr);
        add_exit_procedure([this](){
                //This is only called on immediate abort,
                //meaning the actual destructor won't be called later
                //This is done to ensure resources are released properly and 
                //any held data is written
                this->~engineimp();
                });
        datas_queued=0;
#ifdef ASYNC_IO
        data_io_info dat_inf;
        dat_inf.data_size=&data_size;
        dat_inf.datas_queued = &datas_queued;
        dat_inf.file = &ofile;
        dat_inf.writers = &async_write_queue;
        dat_inf.is_over = &is_over;
        write_thread = std::thread(
                [dat_inf, this](){
                ::write_data(this->condition_lock, this->data_lock, this->write_cond, dat_inf);
                });
#endif
    };
Esempio n. 16
0
bool ReplayProvider::Import(const wxString& filename, bool move)
{
	wxFileName fn(filename);
	if (fn.GetExt().IsSameAs("zip", false))
	{
		// TODO: handle zip files
		wxFileInputStream fstr(filename);
		wxZipInputStream zip(fstr);
		while (wxZipEntry* zipEntry = zip.GetNextEntry())
		{
			wxFileName entryFN(zipEntry->GetName());
			if (entryFN.GetExt().IsSameAs("replay", false))
			{
				wxFileName targetFN(m_localPath, entryFN.GetFullName());
				wxFileOutputStream targetFile(targetFN.GetFullPath());
				zip.Read(targetFile);
				targetFile.Close();
				targetFN.SetTimes(NULL, &zipEntry->GetDateTime(), &zipEntry->GetDateTime());

				Replay::Ptr ri(new Replay(targetFN.GetFullPath()));
				replay.push_back(ri);
			}
		}
	}
	else if (fn.GetExt().IsSameAs("replay", false))
	{
		wxFileName targetFN(m_localPath, fn.GetFullName());
		bool copyRes = wxCopyFile(filename, targetFN.GetFullPath(), false);
		if (copyRes)
		{
			Replay::Ptr ri(new Replay(targetFN.GetFullPath()));
			replay.push_back(ri);
		}

		return copyRes;
	}

	return false;
}
Esempio n. 17
0
std::string
FileReader::read_file( const std::string& filename )
{
    std::ifstream fstr(filename.c_str());
    
    if( !fstr.good() )
    {
        std::stringstream errstr;
        errstr << "Error opening file for reading (" << filename << ")";
        throw IOError( errstr.str() );
    }
  
    try
    {
        return std::string((std::istreambuf_iterator<char>(fstr)), std::istreambuf_iterator<char>());
    }
    catch( const std::exception& e )
    {
        std::stringstream errstr;
        errstr << "Error reading file (" << filename << " msg=\"" << e.what() << "\")";
        throw IOError( errstr.str() );
    }
}
Esempio n. 18
0
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, bool fatal) {

	String fstr(fatal ? "FATAL: " : "");
	String err(fstr + "Index " + p_index_str + "=" + itos(p_index) + " out of size (" + p_size_str + "=" + itos(p_size) + ")");
	_err_print_error(p_function, p_file, p_line, err.utf8().get_data());
}
Esempio n. 19
0
void hPYphocalc(){
	gStyle->SetOptStat(kFALSE);
	const int maxNpart = 100;
	int sth=0, Gth=0;
        TFile *f = TFile::Open(outG);
        if(sth==0){TString dirname = "std";}
        else if(sth==1){TString dirname ="Gri055";}
        else {TString dirname ="Gri101";}
        TObjString* dataname = (TObjString*)f->Get(Form("dataname"));
        TObjString* histoname = (TObjString*)f->Get(Form("histoname"));
	TFile *fdata = TFile::Open(dataname->GetName());
                TString name;
        if(Gth==0)
                name = "G0";
        else if(Gth<nGlau)
                name = Form("Glau_%d",Gth);
        else
                name = Form("bin_%d",Gth-nGlau+1);
        TObjString* Glaubername = (TObjString*)f->Get(Form("%s/%s/Glaubername",dirname.Data(),name.Data()));
        TVectorD* k0 = (TVectorD*)f->Get(Form("%s/%s/k0",dirname.Data(),name.Data()));
        TVectorD* theta0 = (TVectorD*)f->Get(Form("%s/%s/theta0",dirname.Data(),name.Data()));
        TVectorD* xmin = (TVectorD*)f->Get(Form("%s/%s/xmin",dirname.Data(),name.Data()));
        TVectorD* xmax = (TVectorD*)f->Get(Form("%s/%s/xmax",dirname.Data(),name.Data()));
        TVectorD* thetabest = (TVectorD*)f->Get(Form("%s/%s/thetabest",dirname.Data(),name.Data()));
        TVectorD* kbest = (TVectorD*)f->Get(Form("%s/%s/kbest",dirname.Data(),name.Data()));
	TVectorD* kpoint = (TVectorD*)f->Get(Form("%s/%s/kpoint",dirname.Data(),name.Data()));
        TVectorD* NcollAver = (TVectorD*)f->Get(Form("%s/%s/NcollAver",dirname.Data(),name.Data()));
	TVectorD* centbin = (TVectorD*)f->Get(Form("%s/%s/centbin",dirname.Data(),name.Data()));

        TFile *fGlauber = TFile::Open(Glaubername->GetName());
        //(*k0)[0]=1.39;  (*kbest)[0]=0.425;
        //(*theta0)[0]=3.41;      (*thetabest)[0]=1.30;
        TF1 *gammafun[maxNpart];
        TF1 *gammafunevt[maxNpart];
        TF1 *gammafunnucl[maxNpart];
        TF1 *gammafunnuclNcoll[maxNpart];
        double kevt = (*k0)[0]-(*kbest)[0];
        for(int iNpart=0;iNpart<maxNpart;iNpart++){
        	gammafun[iNpart] = new TF1("gammafun","TMath::GammaDist(x,[0],0,[1])",0,200);
		gammafunevt[iNpart] = new TF1("gammafunevt","TMath::GammaDist(x,[0],0,[1])",0,200);
	        gammafunnucl[iNpart] = new TF1("gammafunnucl","TMath::GammaDist(x,[0],0,[1])",0,200);
        	gammafunnuclNcoll[iNpart] = new TF1("gammafunnuclNcoll","TMath::GammaDist(x,[0],0,[1])",0,200);
                double k_=(*k0)[0]+(*kbest)[0]*(iNpart-2);
                double theta_=(*theta0)[0]+(*thetabest)[0]*TMath::Log(iNpart-1);
                gammafun[iNpart]->SetParameter(0,k_);   //[1]: k value
                gammafun[iNpart]->SetParameter(1,theta_);       //[2]: theta value
		gammafunevt[iNpart]->SetParameter(0,kevt);
		gammafunevt[iNpart]->SetParameter(1,theta_);
		gammafunnucl[iNpart]->SetParameter(0,(*kbest)[0]);
		gammafunnucl[iNpart]->SetParameter(1,theta_);
		gammafunnuclNcoll[iNpart]->SetParameter(0,(*kbest)[0]*(iNpart-1));
		gammafunnuclNcoll[iNpart]->SetParameter(1,theta_);
		if(iNpart==2){
			gammafunnuclNcoll[iNpart]->SetNpx(1e4);
			gammafunnuclNcoll[iNpart]->SetRange(1e-11,200);
		}
       }

        TTree *t = (TTree*)fGlauber->Get("nt_p_Pb");
        Float_t Ncoll, Npart, B;        Long_t Nevent;
        t->SetBranchAddress("Ncoll",&Ncoll);
        t->SetBranchAddress("Npart",&Npart);
        t->SetBranchAddress("B",&B);

        Nevent = (Long_t) t->GetEntries();
        Long_t Ev;      Int_t Bino;     Double_t Para, Para_nucl, Para_p, Para_evt, Bi_Para_nucl, Bi_Para_evt;			

	double yUCM[8]={};
	double yPCM[8]={};
	double yVCM[8]={};
	double yUCM_[200]={};
	double yPCM_[200]={};
	double yVCM_[200]={};
	double C=1e-4;
	double PNcoll[maxNpart]={};
	TH1D *histo_obs = (TH1D*)fdata->Get(histoname->GetName());
        TH1D *histo_obs_norm = (TH1D*)histo_obs->Clone();
        histo_obs_norm->Scale(1/histo_obs->Integral());
	TH1D* hUCM = new TH1D("hUCM","hUCM",200,0,200);
	TH1D* hPCM = new TH1D("hPCM","hPCM",200,0,200);
	TH1D* hVCM = new TH1D("hVCM","hVCM",200,0,200);
	TH2D* NcollvsET = new TH2D("NcollvsET","NcollvsET",100,0,100,2000,0,400);
	for(Ev=0;Ev<Nevent;Ev++){
		t->GetEntry(Ev);
		PNcoll[(int)Ncoll]++;
	}
	for(int i=0;i<maxNpart;i++){
		PNcoll[i]/=Nevent;
		cout<<PNcoll[i]<<"\t";
	}
		cout<<endl;
	for(Ev=0;Ev<Nevent;Ev++){
		if(Ev%100000==0)	cout<<"\t"<<"Have run "<<Ev<<" events"<<endl;
		t->GetEntry(Ev);
		Para = gammafun[(int)Npart]->GetRandom();
		Para_nucl = gammafunnuclNcoll[(int)Npart]->GetRandom();
		Para_p = gammafunnuclNcoll[(int)Npart]->GetRandom();
		Para_evt = 0;
		for(int i=0;i<N-1;i++)
			if(Para>=(*kpoint)[i] && Para<(*kpoint)[i+1])
				int ibin = i;
		for(int Bino=0;Bino<Ncoll;Bino++){
			Bi_Para_evt = gammafunevt[(int)Npart]->GetRandom();
			Para_evt += Bi_Para_evt;
		}	
		double PNcollET = gammafun[(int)Npart]->Eval(Para);
//		double k = gammafun[(int)Npart]->GetParameter(0);
                double theta=(*theta0)[0]+(*thetabest)[0]*TMath::Log(Npart-1);
		double YNcollUCM = C*Ncoll;
		double YNcollPCM = C/1.0/(*kbest)[0]/theta*(Para_nucl);
		double YNcollVCM = C/2.0*(Para_nucl/(*kbest)[0]/theta+Ncoll);
		yUCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollUCM;
		yPCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollPCM;
		yVCM[ibin] += PNcoll[(int)Ncoll]*PNcollET*YNcollVCM;
		yUCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollUCM;
		yPCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollPCM;
		yVCM_[(int)Para] += PNcoll[(int)Ncoll]*PNcollET*YNcollVCM;

		NcollvsET->Fill(Ncoll,Para);
	}
	for(int ibin=1;ibin<hUCM->GetNbinsX();ibin++){
		hUCM->SetBinContent(ibin,yUCM_[ibin-1]);			
		hPCM->SetBinContent(ibin,yPCM_[ibin-1]);			
		hVCM->SetBinContent(ibin,yVCM_[ibin-1]);
	}
	TCanvas *c1 = new TCanvas();
	TCanvas *c2 = new TCanvas();
	c1->SetLogy();
	c2->SetLogx();
	c2->SetLogy();
	c2->SetLogz();
	c1->cd();
	TH1D* hFrame = new TH1D("","",200,0,200);
	hFrame->SetTitle("");
	hFrame->GetXaxis()->SetTitle("HF #Sigma E_{T} |#eta|>4");
	hFrame->GetYaxis()->SetTitle("Yield no units");
	hFrame->GetXaxis()->SetRangeUser(0,150);
	hFrame->GetYaxis()->SetRangeUser(1e-6,1);
	hFrame->Draw();
	histo_obs_norm->SetMarkerStyle(20);
	histo_obs_norm->SetMarkerSize(1.0);
	histo_obs_norm->SetMarkerColor(1);
	histo_obs_norm->Draw("Psame");
	hUCM->SetMarkerStyle(24);
	hUCM->SetMarkerSize(1.0);
	hUCM->SetMarkerColor(2);
        hPCM->SetMarkerStyle(29);
        hPCM->SetMarkerSize(1.0);
        hPCM->SetMarkerColor(4);
        hVCM->SetMarkerStyle(34);
        hVCM->SetMarkerSize(1.0);
        hVCM->SetMarkerColor(5);
	hUCM->Draw("Psame");
	hPCM->Draw("Psame");
	hVCM->Draw("Psame");
	TLegend *leg = new TLegend(0.1,0.2,0.5,0.45);	
        leg->SetFillColor(0);
        leg->SetFillStyle(0);
        leg->SetBorderSize(0);
        leg->SetTextFont(42);
        leg->SetTextSize(0.03);
	leg->AddEntry(histo_obs_norm,"minimum bias events","lp");
	leg->AddEntry(hUCM,"hard scattering events(UCM)","lp");
	leg->AddEntry(hPCM,"hard scattering events(PCM)","lp");
	leg->AddEntry(hVCM,"hard scattering events(VCM)","lp");
	leg->Draw("same");
	c1->Print("paperfig3_CMS.png");
	c2->cd();
	gStyle->SetOptStat("nemr");
	NcollvsET->GetXaxis()->SetTitle("Ncoll");
	NcollvsET->GetYaxis()->SetTitle("HF #Sigma E_{T} |#eta|>4");
	NcollvsET->Draw("colz");
	c2->Print("NcollvsET2D.png");
	ofstream fstr("result_CMS.dat");
	fstr<<"i"<<"\t"<<"centbin"<<"\t"<<"kpoint"<<"\t"<<"NcollAver"<<"\t"<<"UCM"<<"\t"<<"PCM"<<"\t"<<"VCM"<<"\t"<<"pho1"<<"\t"<<"pho2"<<"\t"<<"MB"<<endl;
	for(int i=0;i<N-1;i++){
		fstr<<i<<"\t"<<(*centbin)[i]*100<<"% to "<<(*centbin)[i+1]*100<<"% \t"<<(*kpoint)[i]<<" to "<<(*kpoint)[i+1]<<"\t"<<(*NcollAver)[i]<<"\t"<<yUCM[i]<<"\t"<<yPCM[i]<<"\t"<<yVCM[i]<<"\t"<<yPCM[i]/yUCM[i]<<"\t"<<yVCM[i]/yUCM[i]<<"\t"<<"undetermined"<<endl;
	}
}
Esempio n. 20
0
void	inpmon()
{
	int	a,b,c,f=0;

	all_note_off(1);outch=0;prog=0;

	fill(0,544,767,1001,0);box(0,564,767,1001,14,65535);
	sdis(0,548," MIDI INPUT MONITOR",20,15,8);
	home2(512);

	C_WINDOW(0,32);

	B_LOCATE(2,31);B_PRINT("MIDI IN:");B_PRINT(mdinport());

	B_LOCATE(25,31);B_PRINT("OUT MIDI CH.:THRU");
	B_LOCATE(76,31);B_PRINT("[ESC]�ŏI�����܂��B");
	C_WINDOW(4,26);B_LOCATE(0,0);
	midi_clr();

	while(1){
		if(f==0){a=midi_inout();}else{a=f;f=0;}
		if( a<0 ){break;}

		if( a>127 && a<0xf0){B_PRINT("\r\nch=");B_PRINT(fstr((a&15)+1,2));B_PRINT(" : ");}

		if( a>=0x80 && a<=0x9f){
			if( a<0x90 ){B_PRINT("note off :");}else{B_PRINT("note on  :");}
			while(1){
				b=midi_inout();if(b>127 ||b<0){f=b;break;}
				c=midi_inout();
				B_PRINT(keystr(b));B_PRINT(fstr(b,3));B_PRINT(",");
				B_PRINT(fstr(c,3));B_PRINT(":");
			}
			a=-1;
		}
		if( a>=0xa0 && a<=0xaf){
			B_PRINT("after key:");
			while(1){
				b=midi_inout();if(b>127 ||b<0){f=b;break;}
				c=midi_inout();
				B_PRINT(fstr(b,3));B_PRINT(",");
				B_PRINT(fstr(c,3));B_PRINT(":");
			}
			a=-1;
		}
		if( a>=0xb0 && a<=0xbf){
			B_PRINT("control  :");
			while(1){
				b=midi_inout();if(b>127 ||b<0){f=b;break;}
				c=midi_inout();
				B_PRINT(fstr(b,3));B_PRINT(",");
				B_PRINT(fstr(c,3));B_PRINT(":");
			}
			a=-1;
		}
		if( a>=0xc0 && a<=0xcf){
			b=midi_inout();
			B_PRINT("prog ch. : no.=");B_PRINT(fstr(b+1,3));
			a=-1;
		}
		if( a>=0xd0 && a<=0xdf){
			B_PRINT("after ch.:");
			while(1){
				b=midi_inout();if(b>127 ||b<0){f=b;break;}
				B_PRINT(fstr(b,3));B_PRINT(":");
			}
			a=-1;
		}
		if( a>=0xe0 && a<=0xef){
			B_PRINT("pitch    :");
			while(1){
				b=midi_inout();if(b>127 || b<0){f=b;break;}
				c=midi_inout();
				B_PRINT(fstr((c*128+b)-8192,5));
				B_PRINT(":");
			}
			a=-1;
		}
		if( a==0xf0 ){
			B_PRINT("\r\n exclusive : ");
			while(1){
				b=midi_inout();if(b>127 || b<0){f=b;break;}
				B_PRINT(hex_s(b,2));
				B_PRINT("H ");
			}
			a=-1;
		}
		if( a>=0 ){B_PRINT(fstr(a,4));}
	}
	C_WINDOW(0,32);B_CLR_AL();home2(0);
}
Esempio n. 21
0
File: findcent.C Progetto: XuQiao/HI
void findcent()
{
	const int color[10] = {2,3,4,5,6,7,8,4,3,2};
	const double centbin[] = {0,0.005,0.01,0.05,0.1,0.2,0.3,0.4,0.6,1.0};
	//const double centbin[] = {0,0.001,0.005,0.01,0.05,0.1,0.2,0.4,0.6,1.0};
        //double centbin[101];
        //for(int i=0;i<101;i++){
        //    centbin[i]=i*0.01;
        //}
	const double erf = 1e-5;
	int ncent = (int)sizeof(centbin)/sizeof(double);
	//TFile *f = TFile::Open("merged_AnapAlfvtxor.root");
	//TFile *f = TFile::Open("merged_AnapAlfvtxand.root");
	//TFile *f = TFile::Open("merged_AnapAlfvtxsouth.root");
	TFile *f = TFile::Open("merged_AnaMWGppmb.root");
//	TH2F* pc1hitsbbcdis = (TH2F*)f->Get("pc1hitsbbcdis"); 
//	TH1F* pc1hitsdis = (TH1F*)f->Get("pc1hitsdis"); 
//	TH2F* hbbcntrk = (TH2F*)f->Get("hbbcnbbc");
	TH2F* hbbcntrk = (TH2F*)f->Get("hnfvtxtrkbbc");
//	hbbcntrk->RebinX(3);
//	TH1F* bbcsouthdis = (TH1F*)pc1hitsbbcdis->ProjectionX(0,-1);
	TH1F* bbcsouthdis = (TH1F*)hbbcntrk->ProjectionX(0,-1);
//	TH2F* bbcsouthdis = (TH2F*)hbbcntrk->Clone("bbcsouthdis");
	bbcsouthdis->SetTitle("BBC charge distribution");	
	bbcsouthdis->GetXaxis()->SetTitle("BBC charge");	
	bbcsouthdis->GetYaxis()->SetTitle("# of Events");	
//	pc1hitsdis->SetTitle("PC1 hits distribution");	
//	pc1hitsdis->GetXaxis()->SetTitle("PC1 hits");	
//	pc1hitsdis->GetYaxis()->SetTitle("# of Events");	


	ofstream fstr("centbin_bbcmb.txt");
//	fstr<<"centbin"<<"\t"<<"bbcsouth"<<"\t"<<"pc1hits"<<"\t"<<"bbc ratio"<<"\t"<<"pc1hits ratio"<<endl;
	fstr<<"centbin"<<"\t"<<"bbc"<<"\t"<<"bbc ratio"<<endl;
	
	vector<double> bbcs;
//	vector<double> pc1hs;

	for(int icent = 0; icent < ncent; icent++){
		double bbcskp = findpoint(bbcsouthdis,centbin[icent]);
//		double pc1hskp = findpoint(pc1hitsdis,centbin[icent]);
		if(bbcskp<0) bbcskp = 0;
//		if(pc1hskp<0) pc1hskp = 0;
		bbcs.push_back(bbcskp);
cout<<bbcskp<<",";
//		pc1hs.push_back(pc1hskp);
	}
	
	for(int icent = 0; icent < ncent; icent++){
	//	fstr<<centbin[icent]<<"\t"<<bbcs[icent]<<"\t"<<pc1hs[icent]<<"\t"<<bbcsouthdis->Integral(bbcsouthdis->FindBin(bbcs[icent]+erf),bbcsouthdis->FindBin(bbcs[0]-erf))/bbcsouthdis->Integral(bbcsouthdis->FindBin(bbcs[ncent-1]-erf),bbcsouthdis->FindBin(bbcs[0]+erf))<<"\t"<<pc1hitsdis->Integral(pc1hitsdis->FindBin(pc1hs[icent]+erf),pc1hitsdis->FindBin(pc1hs[0]-erf))/pc1hitsdis->Integral(pc1hitsdis->FindBin(pc1hs[ncent-1]-erf),pc1hitsdis->FindBin(pc1hs[0]+erf))<<endl;
		fstr<<centbin[icent]<<"\t"<<bbcs[icent]<<"\t"<<bbcsouthdis->Integral(bbcsouthdis->FindBin(bbcs[icent]+erf),bbcsouthdis->FindBin(bbcs[0]-erf))/bbcsouthdis->Integral(bbcsouthdis->FindBin(bbcs[ncent-1]-erf),bbcsouthdis->FindBin(bbcs[0]+erf))<<endl;
		//fstr<<centbin[icent]<<"\t"<<bbcs[icent]<<"\t"<<bbcsouthdis->Integral(bbcsouthdis->GetXaxis()->FindBin(bbcs[icent]+erf),bbcsouthdis->GetXaxis()->FindBin(bbcs[0]-erf),bbcsouthdis->GetYaxis()->FindBin(bbcs[icent]+erf),bbcsouthdis->GetYaxis()->FindBin(bbcs[0]-erf))/bbcsouthdis->Integral(bbcsouthdis->FindBin(bbcs[ncent-1]-erf,bbcs[ncent-1]-erf),bbcsouthdis->FindBin(bbcs[0]+erf,bbcs[0]+erf))<<endl;
	}

	TCanvas *c1 = new TCanvas();
	//c1->SetLogx();
	c1->SetLogy();
//	c1->SetLogz();
	bbcsouthdis->GetXaxis()->SetRangeUser(0,500);
//	bbcsouthdis->GetYaxis()->SetRangeUser(0,100);
	bbcsouthdis->Draw();
	for(int icent = 0; icent < ncent; icent++){
		TH1F* bbcs_t = (TH1F*)bbcsouthdis->Clone(Form("bbcs_%d",icent));
		bbcs_t->GetXaxis()->SetRangeUser(bbcs[icent+1]-erf,bbcs[icent]+erf);
		//bbcs_t->GetYaxis()->SetRangeUser(bbcs[icent+1]-erf,bbcs[icent]+erf);
		bbcs_t->SetFillColor(color[icent]);
		bbcs_t->Draw("HIST same");
	}
	c1->Print("bbcaddcent.png");
	/*
 	TCanvas *c2 = new TCanvas();
	c2->SetLogy();
	pc1hitsdis->Draw();
	for(int icent = 0; icent < ncent; icent++){
		TH1F* pc1hs_t = (TH1F*)pc1hitsdis->Clone(Form("pc1hs_%d",icent));
		pc1hs_t->GetXaxis()->SetRangeUser(pc1hs[icent+1]-erf,pc1hs[icent]+erf);
		pc1hs_t->SetFillColor(color[icent]);
		pc1hs_t->Draw("HIST same");
	}
	c2->Print("pc1hits.png");
*/
}
Esempio n. 22
0
File: HFBin.C Progetto: XuQiao/HI
void HFBin(){
double goal;
TString dir="output/AN12060/";
TString inputfile="pPbHist_Hijing";
TFile *f=TFile::Open(Form("%s%s.root",dir.Data(),inputfile.Data()));
TH1F* hHF[3];
TString Var[3]={"HFEnergy4","HFEnergyPlus","HFEnergyPlus4"};
ofstream fstr(Form("%s%s_HFbin.txt",dir.Data(),inputfile.Data()));
const int N=5;
double cent[N]={0.1,0.2,0.3,0.6,0.9};
for(int k=0;k<3;k++){
hHF[k]=(TH1F*)f->Get(Form("h%s_tr",Var[k].Data()));
for(int j=0;j<N;j++){
for(int i=1;i<hHF[k]->GetNbinsX();i++){
//cout<<i<<"\t"<<hHF->Integral(1,i)<<endl;
goal=(1-cent[N-j-1])*hHF[k]->Integral();
if(TMath::Abs(hHF[k]->Integral(0,i)-goal)<TMath::Abs(hHF[k]->Integral(0,i+1)-goal)){
fstr<<j<<"th: "<<i<<'\t'<<goal<<endl;
break;
}
}
}
fstr<<hHF[k]->GetName()<<endl;
}

/*
TString Epos_file = "/store/user/tuos/pPb_MC_MinBiasTree_v4_Epos_189k.root";
TString Hijing_file="/store/user/tuos/pPb_MC_MinBiasTree_v4_Hijing_180k.root";
TString Var="PlusEta4";
ofstream fstr(Form("HFbin_DS_%s.txt",Var.Data()));
TFile *fin=TFile::Open(Hijing_file);
fin->cd();
TTree *tree;
tree=(TTree*)hiEvtAnalyzer->Get("HiTree");
tree->AddFriend("skimTree=skimanalysis/HltTree");
tree->AddFriend("hltTree=hltanalysis/HltTree");
tree->AddFriend("genpartTree=genparticles/hi");

const int Maxmult=10000;
Float_t hiHF, vz, hiHFplus,eta[Maxmult];
Float_t hiHFminusEta4, hiHFplusEta4,HFEnergy;
Long_t Ev,Nevent;
Int_t n, HLT_PAZeroBiasPixel_SingleTrack_v1, pprimaryvertexFilter, pVertexFilterCutGplus, pPAcollisionEventSelectionPA, pHBHENoiseFilter,phfPosFilter1, phfNegFilter1,pBeamScrapingFilter;
Int_t Nskim=0;  double weight;  int mult, nDS=0, nPlus35, nMinus35;     int sta[Maxmult];
Nevent=tree->GetEntries();

tree->SetBranchAddress("hiHF",&hiHF);//HF energy
tree->SetBranchAddress("hiHFplus",&hiHFplus);//HF energy positive
tree->SetBranchAddress("hiHFplusEta4",&hiHFplusEta4);//HF energy positive 4 to 5
tree->SetBranchAddress("hiHFminusEta4",&hiHFminusEta4);//HF energy negative -5 to -4
tree->SetBranchAddress("vz",&vz);
tree->SetBranchAddress("HLT_PAZeroBiasPixel_SingleTrack_v1",&HLT_PAZeroBiasPixel_SingleTrack_v1);
tree->SetBranchAddress("pprimaryvertexFilter",&pprimaryvertexFilter);
tree->SetBranchAddress("pVertexFilterCutGplus",&pVertexFilterCutGplus);
//tree->SetBranchAddress("pHBHENoiseFilter",&pHBHENoiseFilter);
tree->SetBranchAddress("pPAcollisionEventSelectionPA",&pPAcollisionEventSelectionPA);
tree->SetBranchAddress("phfPosFilter1",&phfPosFilter1);
tree->SetBranchAddress("phfNegFilter1",&phfNegFilter1);
tree->SetBranchAddress("pBeamScrapingFilter",&pBeamScrapingFilter);
tree->SetBranchAddress("eta",&eta);
tree->SetBranchAddress("sta",&sta);
tree->SetBranchAddress("mult",&mult);
float Minx=0., Maxx=100.;	double centbin[]={0.1,0.2,0.3,0.6,0.9};
const int N=5;
Int_t i, j;
double array[1000000];
Long_t count_Ev=0;
for(Ev=0;Ev<Nevent;Ev++){

tree->GetEntry(Ev);
weight=1.;
//weight*=fVz->Eval(vz);
if(Ev%5000==0)
cout<<"Have run "<<Ev<<" Events"<<endl;
//fstr<<"weight="<<weight<<endl;
tree->GetEntry(Ev);
if(Var=="PlusEta4")
HFEnergy=hiHFplusEta4;
else if(Var=="Plus")
HFEnergy=hiHFplus;
else if(Var=="Eta4")
HFEnergy=hiHFplusEta4+hiHFminusEta4;
else{exit();}
nPlus35=0; nMinus35=0;
for(int j=0; j<mult;j++){
if(eta[j]>3&&eta[j]<5&&sta[j]==1) nPlus35++;
if(eta[j]>-5&&eta[j]<-3&&sta[j]==1) nMinus35++;
}
if(nPlus35>=1 && nMinus35>=1 && TMath::Abs(vz)<15){
if(HFEnergy>=Minx&&HFEnergy<=Maxx){
count_Ev++;
array[count_Ev-1]=HFEnergy;
//if(!(HLT_PAZeroBiasPixel_SingleTrack_v1 && pVertexFilterCutGplus && pPAcollisionEventSelectionPA && pprimaryvertexFilter && TMath::Abs(vz)<15))
//if(!(HLT_PAZeroBiasPixel_SingleTrack_v1 && pVertexFilterCutGplus && pBeamScrapingFilter && phfPosFilter1 && phfNegFilter1 && pprimaryvertexFilter && TMath::Abs(vz)<15))
}
}
}

fstr<<count_Ev<<endl;
int low=0;
int high=count_Ev-1;
int k0[N+1];
double kpoint[N+1];
kpoint[0]=Minx;
kpoint[N]=Maxx;
fstr<<"i=0"<<'\t'<<"kpoint="<<kpoint[0]<<'\t'<<endl;
for(i=1;i<N;i++){
k0[i]=count_Ev*(1-centbin[N-i]);
kpoint[i]=findkth(array,low,high,k0[i]);
fstr<<"i="<<i<<'\t'<<"kpoint="<<kpoint[i]<<'\t'<<endl;
count_Ev=0;
for(Ev=0;Ev<Nevent;Ev++){
tree->GetEntry(Ev);
if(Var=="PlusEta4")
HFEnergy=hiHFplusEta4;
else if(Var=="Plus")
HFEnergy=hiHFplus;
else if(Var=="Eta4")
HFEnergy=hiHFplusEta4+hiHFminusEta4;
else{exit();}
nPlus35=0; nMinus35=0;
for(int j=0; j<mult;j++){
if(eta[j]>3&&eta[j]<5&&sta[j]==1) nPlus35++;
if(eta[j]>-5&&eta[j]<-3&&sta[j]==1) nMinus35++;
}
if(nPlus35>=1 && nMinus35>=1 && TMath::Abs(vz)<15){
if(HFEnergy>=Minx&&HFEnergy<=Maxx){
count_Ev++;
array[count_Ev-1]=HFEnergy;
}
}
}
}
fstr<<"i="<<N<<'\t'<<"kpoint="<<kpoint[i]<<'\t'<<endl;

int PartEvent[N],TotalEvent;

for (Ev=0; Ev<Nevent; Ev++){

                      if(Ev%10000==0) cout<<"Have run "<<Ev/1000<<" thousand events"<<endl;

                        tree->GetEntry(Ev);
if(Var=="PlusEta4")
HFEnergy=hiHFplusEta4;
else if(Var=="Plus")
HFEnergy=hiHFplus;
else if(Var=="Eta4")
HFEnergy=hiHFplusEta4+hiHFminusEta4;
else{exit();}
nPlus35=0; nMinus35=0;
for(int j=0; j<mult;j++){
if(eta[j]>3&&eta[j]<5&&sta[j]==1) nPlus35++;
if(eta[j]>-5&&eta[j]<-3&&sta[j]==1) nMinus35++;
}
if(nPlus35>=1 && nMinus35>=1 && TMath::Abs(vz)<15){
                        for(i=0; i<N; i++)
                        if(HFEnergy>kpoint[i]&&HFEnergy<=kpoint[i+1]){
                                PartEvent[i]++;
                                TotalEvent++;
                        }
}
}
for(i=0;i<N;i++)
fstr<<"SumEvent Percent="<<(double)PartEvent[i]/TotalEvent<<endl;

fin->Close();
*/

}
Esempio n. 23
0
  void initialize()
  {
    //////////////////////////////////////////////////
    // scene and renderer
    //////////////////////////////////////////////////
    _renderer = std::make_shared<gpucast::gl::bezierobject_renderer>();
    std::vector<std::string> filenames;

    gpucast::gl::material default_material;
    default_material.ambient = gpucast::math::vec3f(0.0, 0.0, 0.0);
    default_material.diffuse = gpucast::math::vec3f(0.8, 0.8, 0.8);
    default_material.specular = gpucast::math::vec3f(0.4, 0.4, 0.4);
    default_material.opacity = 1.0;
    default_material.shininess = 1.0;

    //////////////////////////////////////////////////
    // GL ressources
    //////////////////////////////////////////////////
    
    _renderer->add_search_path("../../../");
    _renderer->add_search_path("../../");

    gpucast::gl::resource_factory program_factory;

    _fxaa_program = program_factory.create_program({
      { gpucast::gl::vertex_stage,   "resources/glsl/base/render_from_texture.vert" },
      { gpucast::gl::fragment_stage, "resources/glsl/base/render_from_texture.frag" }
    });

    _renderer->recompile();

    _quad.reset(new gpucast::gl::plane(0, -1, 1));

    _colorattachment.reset(new gpucast::gl::texture2d);
    _depthattachment.reset(new gpucast::gl::texture2d);

    _colorattachment->teximage(0, GL_RGBA32F, GLsizei(_width), GLsizei(_height), 0, GL_RGBA, GL_FLOAT, 0);
    _depthattachment->teximage(0, GL_DEPTH32F_STENCIL8, GLsizei(_width), GLsizei(_height), 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);

    _renderer->attach_custom_textures(_colorattachment, _depthattachment);
    _renderer->set_resolution(_width, _height);
    _renderer->antialiasing(gpucast::gl::bezierobject::disabled);
    _renderer->enable_holefilling(true);

    _sample_linear.reset(new gpucast::gl::sampler);
    _sample_linear->parameter(GL_TEXTURE_WRAP_S, GL_CLAMP);
    _sample_linear->parameter(GL_TEXTURE_WRAP_T, GL_CLAMP);
    _sample_linear->parameter(GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    _sample_linear->parameter(GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    //////////////////////////////////////////////////
    // GL state setup
    //////////////////////////////////////////////////
    _renderer->set_background(gpucast::math::vec3f(0.2f, 0.2f, 0.2f));
    glEnable(GL_DEPTH_TEST);

    //////////////////////////////////////////////////
    // model setup
    //////////////////////////////////////////////////
    if (_argc > 1)
    {
      filenames.clear();
      for (int i = 1; i < _argc; ++i)
      {
        filenames.push_back(_argv[i]);
      }
    }
    else {
      throw std::runtime_error("Usage: igs_viewer_glfw input.igs [input2.igs ... ]");
    }
    
    for (auto const& file : filenames)
    {
      auto ext = boost::filesystem::extension(file);
      if (ext == ".igs" || ext == ".iges" || ext == ".IGS" || ext == ".IGES") {
        open_igs(file, default_material);
      }
      if (ext == ".txt") {
        if (boost::filesystem::exists(file)) {
          std::fstream fstr(file);
          while (fstr) {
            std::string line;
            std::getline(fstr, line);

            boost::char_separator<char> sep(";");
            boost::tokenizer< boost::char_separator<char> > tokens(line, sep);
            std::vector<std::string> stokens(tokens.begin(), tokens.end());
            
            unsigned i = 0;
            if (stokens.size() == 12) {
              std::string filename = stokens[i++];
              gpucast::gl::material custom_material;
              float ar = std::stof(stokens[i++]);
              float ag = std::stof(stokens[i++]);
              float ab = std::stof(stokens[i++]);

              float dr = std::stof(stokens[i++]);
              float dg = std::stof(stokens[i++]);
              float db = std::stof(stokens[i++]);

              float sr = std::stof(stokens[i++]);
              float sg = std::stof(stokens[i++]);
              float sb = std::stof(stokens[i++]);

              custom_material.ambient   = gpucast::math::vec4f{ ar, ag, ab, 1.0f };
              custom_material.diffuse = gpucast::math::vec4f{ dr, dg, db, 1.0f };
              custom_material.specular = gpucast::math::vec4f{ sr, sg, sb, 1.0f };

              custom_material.shininess = std::stof(stokens[i++]);
              custom_material.opacity   = std::stof(stokens[i++]);

              open_igs(filename, custom_material);
            }
          }
          fstr.close();
        }
      }
    }
    reset();
  }
Esempio n. 24
0
File: DrawVz.C Progetto: XuQiao/HI
void DrawVz(){
gStyle->SetOptStat(kFALSE);
gStyle->SetErrorX(0);
ofstream fstr("EventSel.txt");
const int N=6; const int NSel=10;
static const int Color[N]={
   1, 2, 4, 46,6, 7,8
};
static const int Style[N] = {
    20, 34, 33, 25,27, 28//,24
};

TFile *fpPb = TFile::Open("/home/xuq/Documents/HI/RpA/output/TreeAna/JetTrigvzandcent.root");
//TFile *fPbp = TFile::Open("/home/xuq/Documents/HI/RpA/output/TreeAna/DATAPPbakPu3PFskimUniv.root");
TFile *fPbp = TFile::Open("/home/xuq/Documents/HI/RpA/output/TreeAna/PbPJetTrigvzandcent.root");
hVzpPb = (TH1F*)fpPb->Get("vz");
hVzPbp = (TH1F*)fPbp->Get("vz");
hVzpPb->Rebin(5);
hVzPbp->Rebin(5);
hVzpPb->Scale(1./hVzpPb->Integral());
hVzPbp->Scale(1./hVzPbp->Integral());

TH1F* hFrame=new TH1F("","",1000,-50,50);
hFrame->GetXaxis()->SetRangeUser(-15,15);
hFrame->GetYaxis()->SetTitle("Event Fraction");
fixedFontHist(hFrame,1.2,1.7);
TLegend *leg=new TLegend(0.30,0.75,0.70,0.90);
TLine *l=new TLine(-15,1,15,1);
l->SetLineStyle(2);
l->SetLineColor(1);

leg->SetBorderSize(0);
leg->SetFillColor(0);
leg->SetTextFont(42);
leg->SetTextSize(0.04);
leg->SetHeader("After Event Selection");
c1 = new TCanvas("c1"," ",600,600);
c2 = new TCanvas("c2"," ",600,600);
makeMultiPanelCanvas(c1,1,1,-0.08,0,0.12,0.1,0.03);
makeMultiPanelCanvas(c2,1,1,-0.08,0,0.12,0.1,0.03);

c1->cd(1);
hFrame->GetXaxis()->SetTitle("Vz (cm)");
hFrame->GetYaxis()->SetRangeUser(1e-4,6e-2);
hFrame->DrawCopy();
hVzpPb->SetMarkerSize(1.2);
hVzpPb->SetMarkerStyle(20);
hVzpPb->SetMarkerColor(1);
hVzpPb->SetLineColor(1);

hVzPbp->SetMarkerSize(1.2);
hVzPbp->SetMarkerStyle(24);
hVzPbp->SetMarkerColor(2);
hVzPbp->SetLineColor(2);
leg->AddEntry(hVzpPb,"pPb: Pb going positive Data","lp");
leg->AddEntry(hVzPbp,"Pbp: Proton going positive Data","lp");
hVzpPb->Draw("same");
hVzPbp->Draw("same");
leg->Draw("same");
c2->cd(1);
//hFrame->GetYaxis()->SetRangeUser(0.9,1.25);
hFrame->GetYaxis()->SetRangeUser(0.75,1.09);
hFrame->GetYaxis()->SetTitle("Ratio Pbp/pPb");
hFrame->DrawCopy();
hRatio = (TH1F*)hVzPbp->Clone();
hRatio->Divide(hVzpPb);
hRatio->SetMarkerColor(1);
hRatio->SetLineColor(1);
hRatio->SetMarkerStyle(20);
hRatio->Draw("same");
l->Draw("same");
c1->Print("AftEvSelVz_PbppPb.pdf");
c1->Print("AftEvSelVz_PbppPb.png");
c2->Print("AftEvSelVz_PbppPb_ratio.pdf");
c2->Print("AftEvSelVz_PbppPb_ratio.png");
}
Esempio n. 25
0
int main() {
	// アプリウインドウの準備
	AppEnv app_env(Window::WIDTH, Window::HEIGHT);



	while (1){

		int hi_score = 0;
		{
			std::ifstream fstr("score.txt");
			if (fstr)
			{
				fstr >> hi_score;
			}
		}
		Texture title_image("res/title.png");//サイズ512*256
		Texture pstart_image("res/push_start.png");//サイズ512*128
		Texture njp_image("res/NJ-P.png");//サイズ128*256
		Texture suriken_image("res/surikenn.png");//サイズ64*64
		Texture player_image("res/player.png");//サイズ16*16
		Texture ktn_image("res/katana.png");//サイズ64*128
		Texture setu_image("res/Setumei2.png");//サイズ1024*1024
		Texture gst_image("res/gstart.png");//サイズ512*128
		Texture lizlt_image("res/FOR_P.png");//サイズ1024*1024
		Texture titleback_image("res/titleback.png");//サイズ512*128
		Texture yasiki_image("res/yasiki.png");//サイズ512*256
		Texture gover_image("res/p.png");//サイズ900*900
		Texture setu2_image("res/setumei3.png");//サイズ900*900

		Media bg_music("res/bgmusic.wav");
		Media gstart_music("res/gamestart.wav");
		Media gclear_music("res/gameclear.wav");
		Media gover_music("res/gameover.wav");
		Media atk_music("res/atk.wav");

		float pstart_angle = 0.0;
		float gst_angle = 0.0;

		int play_time = 60 * 20;
		int play_point = 0;

		int i1 = 0;
		int i2 = 0;
		int i3 = 0;
		int i4 = 0;
		int i5 = 0;
		int i6 = 0;
		int i7 = 0;
		int i8 = 0;
		int i9 = 0;
		int i10 = 0;
		int i11 = 0;
		int i12 = 0;

		float random1 = 0;
		float random2 = 0;
		float random3 = 0;
		float random4 = 0;
		float random5 = 0;
		float random6 = 0;
		float random7 = 0;
		float random8 = 0;
		float random9 = 0;
		float random10 = 0;
		float random11 = 0;
		float random12 = 0;

		int G1 = 1;
		int G2 = 1;
		int G3 = 1;
		int G4 = 1;
		int G5 = 1;
		int G6 = 1;
		int G7 = 1;
		int G8 = 1;
		int G9 = 1;
		int G10 = 1;
		int G11 = 1;
		int G12 = 1;

		bool on_emy1 = true;
		bool on_emy2 = true;
		bool on_emy3 = true;
		bool on_emy4 = true;
		bool on_emy5 = true;
		bool on_emy6 = true;
		bool on_emy7 = true;
		bool on_emy8 = true;
		bool on_emy9 = true;
		bool on_emy10 = true;
		bool on_emy11 = true;
		bool on_emy12 = true;

		int vx1 = 0;
		int vx2 = 0;
		int vx3 = 0;
		int vx4 = 0;
		int vx5 = 0;
		int vx6 = 0;

		int vy1 = 0;
		int vy2 = 0;
		int vy3 = 0;
		int vy4 = 0;
		int vy5 = 0;
		int vy6 = 0;

		int x1 = 0;

		int x = 0;
		int y = 0;

		app_env.bgColor(Color(0.3, 0.3, 0.3));

		// メインループ

		float ktn_angle = 0;
		bool ktn = false;
		float A = 4;
		int r = 0;
		int r1 = 0;

		gstart_music.play();
		gstart_music.looping(true);
		gstart_music.gain(0.5);

		while (1) {

			int hi_score = 0;
			{
				std::ifstream fstr("score.txt");
				if (fstr)
				{
					fstr >> hi_score;
				}
			}

			{
				// ウィンドウが閉じられたらアプリを終了
				if (!app_env.isOpen()) return 0;

				// 描画準備
				app_env.setupDraw();

				dispPlayPoint(hi_score);

				if (app_env.isPushButton(Mouse::LEFT)) break;
				if (app_env.isPushButton(Mouse::RIGHT)) break;

				drawTextureBox(0 - 512 / 2, 0,
					512, 256,
					0, 0, 512, 256,
					title_image,
					Color(1, 1, 1));

				pstart_angle += 0.1;
				float pstart_color = (std::sin(pstart_angle));
				if (pstart_color > 0){
					pstart_color = 1;
				}

				std::cout << pstart_color << std::endl;

				drawTextureBox(0 - 512 / 2, -330,
					512, 128,
					0, 0, 512, 128,
					pstart_image,
					Color(pstart_color, pstart_color, pstart_color));
				// ここにゲームの処理を書く
				// 
				K = 1;
				// 画面を更新
				app_env.update();
			}

			app_env.flushInput();
		}

		while (1){

			// ウィンドウが閉じられたらアプリを終了
			if (!app_env.isOpen()) return 0;

			// 描画準備
			app_env.setupDraw();

			drawTextureBox(-1000 / 2, -900 / 2 + 10,
				1024, 1024,
				0, 0,
				1000, 900,
				setu_image,
				Color(1, 1, 1));

			if (app_env.isPushKey(GLFW_KEY_ENTER)){
				gstart_music.looping(false);
				gstart_music.stop();
				break;
			}

			gst_angle += 0.1;
			float gst_color = (std::sin(gst_angle));
			if (gst_color > 0){
				gst_color = 1;
			}

			drawTextureBox(0 - 512 / 2, -900 / 2 - 5 + 10,
				512, 128,
				0, 0, 512, 128,
				gst_image,
				Color(gst_color, gst_color, gst_color));

			app_env.update();
		}

		app_env.flushInput();
/*		while (1){

			// ウィンドウが閉じられたらアプリを終了
			if (!app_env.isOpen()) return 0;

			// 描画準備
			app_env.setupDraw();

			drawTextureBox(-900 / 2, -900 / 2,
				1024, 1024,
				0, 0, 900, 900,
				setu2_image,
				Color(1, 1, 1));

			if (app_env.isPushKey(GLFW_KEY_ENTER)){
				gstart_music.looping(false);
				gstart_music.stop();
				break;
			}
			app_env.update();
		}
		app_env.flushInput();
*/

		bg_music.play();
		bg_music.looping(true);
		bg_music.gain(0.1);

		while (1){
			{
				if (!app_env.isOpen()) return 0;

				app_env.setupDraw();


				float angle = 0;
				angle = angle + 0.1;
				Vec2f mouse_pos = app_env.mousePosition();

				drawFillCircle(mouse_pos.x(), mouse_pos.y(),
					8, 8,
					100,
					Color(1, 0, 0));

				ktn_angle -= 0.49;

				if (app_env.isPushButton(Mouse::LEFT)){
					ktn = true;
				}
			   
				if (ktn == true){
					atk_music.play();
					atk_music.gain(0.2);

					drawTextureBox(mouse_pos.x(), mouse_pos.y(),
						64, 128,
						0, 0, 64, 128,
						ktn_image,
						Color(1, 1, 1),
						M_PI*ktn_angle,
						Vec2f(1, 1),
						Vec2f(1, 1));
					A -= 1;
					if (A < 0){
						ktn = false;
						A = 4;
					}
				}

				drawTextureBox(-900 / 2 + 30, -900 / 2,
					128, 256,
					0, 0, 128, 256,
					njp_image,
					Color(1, 1, 1));

				time_t date;
				srand(time(&date));
				r1 = rand() % 4;
				random1 = rand() % 450 * -1;
				random2 = rand() % 450;
//				random3 = rand() % 450 * -1;
				random4 = rand() % 450 * -1;
				random5 = rand() % 450;
//				random6 = rand() % 450 * -1;
				random7 = rand() % 450 * -1;
				random8 = rand() % 450;
//				random9 = rand() % 450 * -1;
				random10 = rand() % 450 * -1;
				random11 = rand() % 450;
//				random12 = rand() % 450 * -1;

				float x1 = -450 + vx1;
				float x2 = -450 + vx2;
//				float x3 = -450 + vx3;
				float x4 = 450 + vx4;
				float x5 = 450 + vx5;
//				float x6 = 450 + vx6;
				float y7 = -450 + vy1;
				float y8 = -450 + vy2;
//				float y9 = -450 + vy3;
				float y10 = 450 + vy4;
				float y11 = 450 + vy5;
//				float y12 = 450 + vy6;

				float y1 = random1;
				float y2 = random2;
//				float y3 = random3;
				float y4 = random4;
				float y5 = random5;
//				float y6 = random6;
				float x7 = random7;
				float x8 = random8;
//				float x9 = random9;
				float x10 = random10;
				float x11 = random11;
//				float x12 = random12;

				on_emyA(G1, x1, y1, mouse_pos, A, on_emy1, play_point);
				on_emy(r1, r, on_emy1, x1, random1, vx1, suriken_image);
				on_emyRf(on_emy1, i1, G1, vx1);

				on_emyA(G2, x2, y2, mouse_pos, A, on_emy2, play_point);
				on_emy(r1, r, on_emy2, x2, random2, vx2, suriken_image);
				on_emyRf(on_emy2, i2, G2, vx2);

/*				on_emyA(G3, x3, y3, mouse_pos, A, on_emy3, play_point);
				on_emy(r1, r, on_emy3, x3, random3, vx3, suriken_image);
				on_emyRf(on_emy3, i3, G3, vx3);
*/
				on_emyA(G4, x4, y4, mouse_pos, A, on_emy4, play_point);
				on_emyR(r1, r, on_emy4, x4, random4, vx4, suriken_image);
				on_emyRf(on_emy4, i4, G4, vx4);

				on_emyA(G5, x5, y5, mouse_pos, A, on_emy5, play_point);
				on_emyR(r1, r, on_emy5, x5, random5, vx5, suriken_image);
				on_emyRf(on_emy5, i5, G5, vx5);

/*				on_emyA(G6, x6, y6, mouse_pos, A, on_emy6, play_point);
				on_emyR(r1, r, on_emy6, x6, random6, vx6, suriken_image);
				on_emyRf(on_emy6, i6, G6, vx6);
*/
				on_emyA(G7, x7, y7, mouse_pos, A, on_emy7, play_point);
				on_emy(r1, r, on_emy7, random7, y7, vy1, suriken_image);
				on_emyRf(on_emy7, i7, G7, vy1);

				on_emyA(G8, x8, y8, mouse_pos, A, on_emy8, play_point);
				on_emy(r1, r, on_emy8, random8, y8, vy2, suriken_image);
				on_emyRf(on_emy8, i8, G8, vy2);

/*				on_emyA(G9, x9, y9, mouse_pos, A, on_emy9, play_point);
				on_emy(r1, r, on_emy9, random9, y9, vy3, suriken_image);
				on_emyRf(on_emy9, i9, G9, vy3);
*/
				on_emyA(G10, x10, y10, mouse_pos, A, on_emy10, play_point);
				on_emyR(r1, r, on_emy10, random10, y10, vy4, suriken_image);
				on_emyRf(on_emy10, i10, G10, vy4);

				on_emyA(G11, x11, y11, mouse_pos, A, on_emy11, play_point);
				on_emyR(r1, r, on_emy11, random11, y11, vy5, suriken_image);
				on_emyRf(on_emy11, i11, G11, vy5);

/*				on_emyA(G12, x12, y12, mouse_pos, A, on_emy12, play_point);
				on_emyR(r1, r, on_emy12, random12, y12, vy6, suriken_image);
				on_emyRf(on_emy12, i12, G12, vy6);
*/
/*      		if (K == 1){
					drawTextureBox(-512 / 2 + 80, -100,
						512, 256,
						0, 0, 512, 256,
						yasiki_image,
						Color(1, 1, 1));
				}

				if (K == 1){
					if (vx1 >= 350 || vx2 >= 350 || vx3 >= 350 || vx4 <= -390 || vx5 <= -390 || vx6 <= -390) {
						if (random1 <= 80 && random1 >= -80 || random2 <= 100 && random2 >= -100 || random3 <= 100 && random3 >= -100 || random4 <= 100 && random4 >= -100 || random5 <= 100 && random5 >= -100 || random6 <= 100 && random6 >= -100){
							K = 0;
							E = 1;
							bg_music.looping(false);
							break;
						}
					}
				}

				if (K == 1){
					if (vy1 >= 350 || vy2 >= 350 || vy3 >= 350 || vy4 <= -460 || vy5 <= -460 || vy6 <= -460) {
						if (random7 <= 256 && random7 >= -256 || random8 <= 256 && random8 >= -256 || random9 <= 256 && random9 >= -256 || random10 <= 256 && random10 >= -256 || random11 <= 256 && random11 >= -256 || random12 <= 256 && random12 >= -256){
							K = 0;
							E = 1;
							bg_music.looping(false);
							break;
						}
					}
				}
*/
				// ここにゲームの処理を書く

				{
					dispPlayPoint(play_point);

					{
						float x = -900 / 2;
						float y = -900 / 2;

						float width = 30;
						float height = (play_time * 250) / (60 * 20);

						drawFillBox(x, y,
							width, height,
							Color(1, 1, 0));
						drawBox(x, y,
							width, 250, 2,
							Color(1, 1, 1));

					}

					play_time -= 1;

					if (play_time == 0) break;

					if (play_point > hi_score){
						std::ofstream fstr("score.txt");
						if (fstr){
							fstr << play_point << std::endl;
						}

					}

				}

				app_env.update();
			}
			app_env.flushInput();

		}
		int M = 1;
		while (1){

			if (!app_env.isOpen()) return 0;

			app_env.setupDraw();
			
			if (E == 1){

					bg_music.stop();

					drawTextureBox(-450, -450,
						1024, 1024,
						0, 0, 900, 900,
						gover_image,
						Color(1, 1, 1));

					if (M == 1){
						gover_music.play();
						gover_music.gain(0.5);
						M = 0;
					}

					if (app_env.isPressKey(GLFW_KEY_ENTER)){
						gover_music.looping(false);
						gover_music.stop();
						break;
					}
				}

				if (E == 0){
					bg_music.stop();

					drawTextureBox(-900 / 2, -900 / 2-100,
						1024, 1024,
						0, 0,
						900, 900,
						lizlt_image,
						Color(1, 1, 1));

					drawTextureBox(-512 / 2, -330,
						512, 128,
						0, 0, 512, 128,
						titleback_image,
						Color(1, 1, 1));

					dispPlayPoint(play_point);

					if (M == 1){
						gclear_music.play();
						gclear_music.looping(true);
						gclear_music.gain(0.5);
						M = 0;
					}

					if (app_env.isPressKey(GLFW_KEY_ENTER)){
						gclear_music.looping(false);
						gclear_music.stop();
						break;
					}
				}

				app_env.update();
			}

			app_env.flushInput();

		}

		// アプリ終了
	}
Esempio n. 26
0
// 
// メインプログラム//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 
int main() {
	// アプリウインドウの準備
	AppEnv app_env(Window::WIDTH, Window::HEIGHT);

	int	LINE_y1 = 0;
	int pointer_mark1 = 0;
	int pointer_mark2 = 0;
	int pointer_mark3 = 0;

	while (1){
		srand((unsigned)time(NULL));

		//
		int hi_score = 0;
		{
			std::ifstream fstr("res/score.txt");
			if (fstr){
				fstr >> hi_score;
			}
		}

		//タイトル画面///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		{
			//タイトル画像
			Texture title_image("res/title1.png");

			
			
			
				//サウンドの読み込み
				Media sound("res/Clover1.wav");
				//再生
				sound.play();
				sound.looping(true);
				//音量(0.0~1.0)
				sound.gain(0.1);

			
			
			
			//停止
			//sound.stop();
			//一時停止
			//sound.pause();
			
			

			//「Click to Start」演出用変数を用意
			float title_angle = 0.0;

			int blink = 0;



			// メインループ
			while (1) {

				// ウィンドウが閉じられたらアプリを終了
				if (!app_env.isOpen()) return 0;

				// 描画準備
				app_env.setupDraw();



				//マウスのボタンがクリックされたらゲーム本編へ
				if (app_env.isPushButton(Mouse::LEFT)) break;
				//if (app_env.isPushButton(Mouse::RIGHT))break;
				if (app_env.isPushKey(GLFW_KEY_ENTER)) break;
				if (app_env.isPushKey(GLFW_KEY_ESCAPE)) return 0;

				//「Click to Start」演出用変数を変更
				title_angle += 0.05;
				//sinの値の絶対値を色に利用
				int value = (blink / 30) % 2;
				float title_color = std::abs(std::sin(title_angle));
				float		color = 0;
				if (title_color = 1){
					color = 1;
					if (color = 1){
						color = std::abs(std::sin(title_angle));
					}
				}


				blink += 1;

				std::cout << blink << std::endl;	//←??

				if (value >= 0) {
					title_color = 1;
					if (value < 1) {
						title_color = 0;
					}
				}



				if (value){
					//タイトルロゴ
					drawTextureBox(0 - 512 / 2,//半分の計算をPCにさせると簡単
						0 + 512 / 2, 512, 512 / 4,
						0, 0, 512, 512 / 4,
						title_image,
						Color(title_color, value, value));
				}
				//「あみだくじ」
				drawTextureBox(0 - 512 / 2,
					0 - 512 / 2,
					512, 512,
					0, 512 / 4,
					512, 512 - 512 / 4,
					title_image,
					Color(1, 1, 1));



				//ハイスコア
				//dispPlayPoint(hi_score);

				// 画面を更新
				app_env.update();
			}
			//入力のフラッシュ
			app_env.flushInput();
		}

		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//ゲームで使うさまざまな変数
		//プレイ時間(15秒)
		int time_1 = 15;
		int play_time = 60 * time_1;	//60=1秒間に60ループ
		//得点
		int play_point = 0;

		//取り出したカードの場所
		//int card_index = 0;
		

		app_env.random().setSeed(rand());




		//ゲーム本編/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		{
			
			int top_y = HEIGHT / 3;			//縦線の始点
			int under_y = -HEIGHT / 3;		//縦線の終点
			int top_plus = top_y + 20;		//スタートの位置
			int under_minus = under_y - 20;	//ゴールの位置

			//縦線の配置
			float A_X = WIDTH / 3;
			float B_X = WIDTH / 6;
			float C_X = 0;
			float D_X = -(WIDTH / 6);
			float E_X = -(WIDTH / 3);

			//ドット位置の構造体
			struct Dot_point{
				int x, y;
				bool dot;
				int x2, y2;
				bool flag;
			};
			
			//ドット位置
			Dot_point pointer[20] = {
				//A_X
				{ A_X, top_plus, false, B_X, top_plus, false },
				{ A_X, top_plus, false, C_X, top_plus, false },
				{ A_X, top_plus, false, D_X, top_plus, false },
				{ A_X, top_plus, false, E_X, top_plus, false },
				//B_X
				{ B_X, top_plus, false, A_X, top_plus, false },
				{ B_X, top_plus, false, C_X, top_plus, false },
				{ B_X, top_plus, false, D_X, top_plus, false },
				{ B_X, top_plus, false, E_X, top_plus, false },
				//C_X
				{ C_X, top_plus, false, A_X, top_plus, false },
				{ C_X, top_plus, false, B_X, top_plus, false },
				{ C_X, top_plus, false, D_X, top_plus, false },
				{ C_X, top_plus, false, E_X, top_plus, false },
				//D_X
				{ D_X, top_plus, false, A_X, top_plus, false },
				{ D_X, top_plus, false, B_X, top_plus, false },
				{ D_X, top_plus, false, C_X, top_plus, false },
				{ D_X, top_plus, false, E_X, top_plus, false },
				//E_X
				{ E_X, top_plus, false, A_X, top_plus, false },
				{ E_X, top_plus, false, B_X, top_plus, false },
				{ E_X, top_plus, false, C_X, top_plus, false },
				{ E_X, top_plus, false, D_X, top_plus, false },
				//


			};

			


			//ライン位置の構造体
			struct LINE{
				int y1;				//横線のy座標(高さ)
				int x1;				//横線の場所(始点)
				int x2;				//横線の場所(終点)
				bool LINE_ON;		//横線の表示設定
				bool Cursor_ON;		//カーソルが乗っているかの判定
				int R,B,G;			//色
				int n18;			//わかりやすく数字振り分けただけ
				
			};
			//横線の数列
			LINE side[18] = {
				//一番右の横線0~3
				{ 290, A_X, B_X, true, true, 1, 0, 0,0 },
				{ 145, A_X, B_X, true, true, 1, 0, 0,1 },
				{ 0, A_X, B_X, true, true, 1, 0, 0 ,2},
				{ -145, A_X, B_X, true, true, 1, 0, 0,3 },
				
				//右から二番目の横線4~6
				{ 218, B_X, C_X, true, true, 1, 0, 0 ,5},
				{ 73, B_X, C_X, true, true, 1, 0, 0 ,6},
				{ -218, B_X, C_X, true, true, 1, 0, 0 ,8},

				//左から二番目の横線7~10
				{ 290, C_X, D_X, true, true, 1, 0, 0 ,9},
				{ 145, C_X, D_X, true, true, 1, 0, 0 ,10},
				{ 0, C_X, D_X, true, true, 1, 0, 0 ,11},
				{ -145, C_X, D_X, true, true, 1, 0, 0 ,12},
				
				//一番左の横線11~13
				{ 218, D_X, E_X, true, true, 1, 0, 0 ,14},
				{ 73, D_X, E_X, true, true, 1, 0, 0 ,15},
				{ -218, D_X, E_X, true, true, 1, 0, 0 ,17},
				

				//残す横線14~17
				{ -290, A_X, B_X, true, true, 1, 0, 0 ,4},
				{ -73, B_X, C_X, true, true, 1, 0, 0 ,7},
				{ -290, C_X, D_X, true, true, 1, 0, 0 ,13},
				{ -73, D_X, E_X, true, true, 1, 0, 0 ,16},
				

			};



			//あたり判定座標
			
			int Y_1[]{ 290, 145, 0, -145, -290, 
					   218, 73, -73, -218};
			
			int i = 0;
			int a = 0;
			while(true)
			{
			//ifじゃいけないん?
			if (i <= 5){

				LINE_y1 = app_env.random().fromFirstToLast(0, 13);
				
				side[LINE_y1].LINE_ON = false;

				i++;
				
			/*{
				return top_y + (under_y - top_y + 1) * fromZeroToOne()
				}*/
			//while (i < 52){
			//std::swap(cards_info[i],
			//cards_info[app_env.random().fromZeroToLast(52)]);
			
			}

			
			
			
			if (a < 1){		
				pointer_mark1 = app_env.random().fromFirstToLast(0, 19);
				
				pointer[pointer_mark1].dot = true;
				a++;
			}
			
			
			if((a > 1) && (i >= 6))
			{
				break;
			}


			//メインループ
			while (1){
				//ウインドウが閉じられたら終了
				if (!app_env.isOpen()) return 0;
				//描画準備
				app_env.setupDraw();
				//if (!app_env.isPressKey(GLFW_KEY_ENTER)){

				
				
				//表示サイズ(残り時間を矩形の横幅で表現)
				
		
				

				//縦線
				drawLine(A_X, top_y, A_X, under_y, 5, Color(1, 1, 1));
				drawLine(B_X, top_y, B_X, under_y, 5, Color(1, 1, 1));
				drawLine(C_X, top_y, C_X, under_y, 5, Color(1, 1, 1));
				drawLine(D_X, top_y, D_X, under_y, 5, Color(1, 1, 1));
				drawLine(E_X, top_y, E_X, under_y, 5, Color(1, 1, 1));


				//マウスの位置を変数にコピー
				Vec2f mouse_pos = app_env.mousePosition();
				//左クリックをしたかどうかを変数にコピー
				bool left_click = app_env.isPushButton(Mouse::LEFT);

				//横線
				{
					int a = 0;
					int move_x = 0, move_y = 0;
					int yyy = 0;

					int sss = 0;
					int move_d = 0;
					int i = 0;
					/*while文じゃなくてもif文で条件ループはかけると思う。*/
					if (i <= 17)
					{
						if (side[i].LINE_ON){
							drawLine(side[i].x1, side[i].y1, side[i].x2, side[i].y1, 5, Color(1, 1, 1));		//ライン表示
						}
						i++;
					}
					if (a <= 20){
						if (pointer[a].dot){
							drawPoint(pointer[a].x, pointer[a].y, 100, Color(1, 0, 0));							//ドット表示
							drawPoint(pointer[a].x2, pointer[a].y2, 100, Color(1, 0, 0));						//ドット表示
							move_y = move_y - 1;
							move_x = move_x + 1;
							move_d = move_d - 1;

							if (pointer[a].flag = true){														//もしフラグがオンの時

								pointer[a].y += move_y;
								pointer[a].y2 += move_y;
								if (pointer[a].y == Y_1[yyy],side[sss].y1 == Y_1[yyy], yyy <= 8, sss <= 17){													//Y座標が218なら
									
									sss++;
									
										if (side[sss].LINE_ON == true) {												//横線の表示がオンなら
											if (pointer[a].x == B_X) {												//右側なら
												pointer[a].y = Y_1[yyy];
												pointer[a].x += move_d;
												if (pointer[a].x == C_X){											//左に付いたら
													pointer[a].y += move_y;
												}

											}
											else
											{
												if (pointer[a].x == C_X){
													pointer[a].y = Y_1[yyy];
													pointer[a].x += move_x;
													if (pointer[a].x == B_X){
														pointer[a].y += move_y;
													}
												}

											}
											if (pointer[a].x == D_X) {
												pointer[a].y = Y_1[yyy];
												pointer[a].x += move_d;
												if (pointer[a].x == E_X){
													pointer[a].y += move_y;
												}

											}
											else
											{
												if (pointer[a].x == E_X){
													pointer[a].y = Y_1[yyy];
													pointer[a].x += move_x;
													if (pointer[a].x == D_X){
														pointer[a].y += move_y;
													}
												}

											}
										}
											
									yyy++;
								}
								
								if (pointer[a].y <= under_y){
									pointer[a].y = under_y;
								}
								if (pointer[a].y2 <= under_y){
									pointer[a].y2 = under_y;
								}
								if (pointer[a].y == pointer[a].y2){
									break;
								}

								move_y++;

							}
						}



						a++;
					}
						

					

					//残り時間表示
					{
						//位置表示
						float x = -100;
						float y = -Window::HEIGHT / 2 + 50;

						//表示サイズ(残り時間を矩形の横幅で表現)
						float width = (play_time * 200) / (60 * time_1);
						float height = 30;

						//残り時間を矩形で表示
						//drawFillBox(x + width, y, 200-width, height, Color(0, 1, 1));  //右から左に増える
						drawFillBox(x + (200-width), y, width, height, Color(0, 1, 1));  //左から右に減る
						//drawFillBox(x-(200+width), y, width, height, Color(0, 1, 1));
						//ゲージを逆にするならxの値を(x+(200-width))にする
						//0から増やす場合は(200-width)逆は(x+width)を追加
						//枠線
						drawBox(x, y, 200, height, 2, Color(1, 1, 1));
					}

					//得点表示
					//dispPlayPoint(play_point);

					//プレイ時間を減らす
					play_time -= 1;
					//時間が無くなったらループを抜ける
					if (play_time == 0)break;
					
						

					//画面を更新
					app_env.update();
				}

				app_env.flushInput();
			}
		}
		/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//ハイスコア更新チェック
		while(true)
		{
		if (play_point > hi_score){
			std::ofstream fstr("res/score.txt");
			if (fstr){

				fstr << play_point << std::endl;
			}
		}

			break;

		}

		//結果画面///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		{
			//結果画面の画像
			Texture results_image("res/results.png");

			//結果画面の演出用変数
			float angle = 0.0;

			//メインループ
			while (1){
				//ウインドウが閉じられたら終了
				if (!app_env.isOpen())return 0;

				//描画準備
				app_env.setupDraw();

				//演出用の変数を変更
				angle += 0.2;
				//sinの値が0.0~1.0に収まるように計算
				float color_red = (std::sin(angle) + 1.0) / 2.0;

				//「終了」表示
				drawTextureBox(-512 / 2, -128 / 2, 512, 128,
					0, 0, 512, 128,
					results_image,
					Color(color_red, 1, 1));

				//得点表示
				//dispPlayPoint(play_point);
				//画面を更新
				app_env.update();
				if (app_env.isPushKey(GLFW_KEY_ENTER)) break;
				if (app_env.isPushKey(GLFW_KEY_ESCAPE)) return 0;
				//if (app_env.isPushButton(Mouse::LEFT)) break;
				//if (app_env.isPushButton(Mouse::RIGHT))break;
			}
		}
		app_env.flushInput();

	}
  return 0;
	// アプリ終了////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
Esempio n. 27
0
bool setupTexture(const GLuint id, const char* file, const int width, const int height){
    
    std::ifstream fstr(file,std::ios::binary);
    
    if(!fstr) {
        return false;
    }
    
    //ファイルの最初から最後まで読み込んだときのサイズ?
    const size_t file_size = static_cast<size_t> (fstr.seekg(0,fstr.end).tellg());
    //開始位置に戻す
    fstr.seekg(0, fstr.beg);
    
    //画像がなんでchar型のvecterに保存できる
    /*
     ★CHAR = char
     1バイト(8ビット) -128~127
     
     ★BYTE = unsigned char
     1バイト(8ビット) 0~255
     */
    //byteではだめか?後ほど試してみる
    std::vector<char> texture_buffer(file_size);
    
    fstr.read(&texture_buffer[0],file_size);
    
    glBindTexture(GL_TEXTURE_2D,id);
    
    //1ピクセルに赤,翠,青,αの情報
    //幅256,高さ256 転送
    //2Dて関数名に書いてあるのになんでわざわざ引数で指定しなきゃならんのか?
    glTexImage2D(
                 GL_TEXTURE_2D,
                 0,
                 //テクスチャをOpenGL内部で保持する形式?
                 GL_RGBA,
                 width ,height,
                 0,
                 //引数pixelsに指定したメモリ上の画像形式? GLでのテクスチャの保持と画像保持は別もの・
                 GL_RGBA,
                 GL_UNSIGNED_BYTE,
                 &texture_buffer[0]
                 );
    
    //画像拡大時の振る舞い
    glTexParameteri(
                    GL_TEXTURE_2D,
                    GL_TEXTURE_MAG_FILTER,
                    GL_LINEAR
                    );
    
    //画像が縮小された場合の振る舞い
    glTexParameteri(
                    GL_TEXTURE_2D,
                    GL_TEXTURE_MIN_FILTER,
                    GL_LINEAR);
    
    //丸め込み方法 //色々試すと面白い
    
    glTexParameteri(
                    GL_TEXTURE_2D,
                    GL_TEXTURE_WRAP_T,
                    GL_MIRRORED_REPEAT
    );
    glTexParameteri(
                    GL_TEXTURE_2D,
                    GL_TEXTURE_WRAP_S,
                    GL_MIRRORED_REPEAT
                    );
    
    
    
    return true;
}
Esempio n. 28
0
BOOL CPPageOutput::OnInitDialog()
{
    __super::OnInitDialog();

    SetHandCursor(m_hWnd, IDC_AUDRND_COMBO);

    const CAppSettings& s = AfxGetAppSettings();
    const CRenderersSettings& renderersSettings = s.m_RenderersSettings;

    m_iDSVideoRendererType  = s.iDSVideoRendererType;
    m_iRMVideoRendererType  = s.iRMVideoRendererType;
    m_iQTVideoRendererType  = s.iQTVideoRendererType;

    m_APSurfaceUsageCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_SURF_OFFSCREEN));
    m_APSurfaceUsageCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_SURF_2D));
    m_APSurfaceUsageCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_SURF_3D));
    m_iAPSurfaceUsage       = renderersSettings.iAPSurfaceUsage;

    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZE_NN));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BILIN));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BIL_PS));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BICUB1));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BICUB2));
    m_DX9ResizerCtrl.AddString(ResStr(IDS_PPAGE_OUTPUT_RESIZER_BICUB3));
    m_iDX9Resizer           = renderersSettings.iDX9Resizer;

    m_fVMR9MixerMode        = renderersSettings.fVMR9MixerMode;
    m_fVMR9MixerYUV         = renderersSettings.fVMR9MixerYUV;
    m_fVMR9AlterativeVSync  = renderersSettings.m_RenderSettings.fVMR9AlterativeVSync;
    m_fD3DFullscreen        = s.fD3DFullscreen;

    int EVRBuffers[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 35, 40, 45, 50, 55, 60};
    CString EVRBuffer;
    for (size_t i = 0; i < _countof(EVRBuffers); i++) {
        EVRBuffer.Format(_T("%d"), EVRBuffers[i]);
        m_EVRBuffersCtrl.AddString(EVRBuffer);
    }
    m_iEvrBuffers.Format(L"%d", renderersSettings.iEvrBuffers);

    m_iAudioRendererTypeCtrl.SetRedraw(FALSE);
    m_fResetDevice = s.m_RenderersSettings.fResetDevice;
    m_AudioRendererDisplayNames.Add(_T(""));
    m_iAudioRendererTypeCtrl.AddString(_T("1: ") + ResStr(IDS_PPAGE_OUTPUT_SYS_DEF));
    m_iAudioRendererType = 0;

    int i = 2;
    CString Cbstr;

    BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker) {
        LPOLESTR olestr = NULL;
        if (FAILED(pMoniker->GetDisplayName(0, 0, &olestr))) {
            continue;
        }

        CStringW str(olestr);
        CoTaskMemFree(olestr);

        m_AudioRendererDisplayNames.Add(CString(str));

        CComPtr<IPropertyBag> pPB;
        if (SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB))) {
            CComVariant var;
            pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);

            CString fstr(var.bstrVal);

            var.Clear();
            if (SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL))) {
                BSTR* pbstr;
                if (SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr))) {
                    fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
                    SafeArrayUnaccessData(var.parray);
                }
            }
            Cbstr.Format(_T("%d: %s"), i, fstr);
        } else {
            Cbstr.Format(_T("%d: %s"), i, CString(str));
        }
        m_iAudioRendererTypeCtrl.AddString(Cbstr);

        if (s.strAudioRendererDisplayName == str && m_iAudioRendererType == 0) {
            m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount() - 1;
        }
        i++;
    }
Esempio n. 29
0
        GwtVantageFxBundle::GwtVantageFxBundle() {

            add("com.optionfair.client.model.ClientUpdatePack/839029662", {
                fstd("some_1"),
                fptr("assetUpdates"),
                fptr("money"),
                fptr("some_3"),
                fstd("instrumentType"),
                fstd("some_5"),
                fstd("some_6"),
                fstd("some_7"),
                fptr("options"),
                fstd("some_10"),
                fptr("some_11"),
                fptr("optionUpdates"),
                fstd("some_12"),
                fstd("some_13"),
                fptr("some_14"),
                fstd("some_15"),
                fptr("positionsSentimentDto"),
                fptr("positionUpdates"),
                fint("some_17"),
                fint("some_18"),
                fint("some_19"),
                fptr("some_20"),
                flng("date"),
                fptr("some_22"),
                fint("some_23"),
                fint("some_24")
            });

            add("com.optionfair.client.model.PositionsSentimentDTO/3338833266", {
                fptr("map"),
                fstd("some_1"),
                fstd("some_2")
            });

            add("com.optionfair.client.model.FeedTickUpdate/4036343884", {
                fdbl("some_1"),
                fptr("date"),
                fstd("some_2"),
                fstd("some_3")
            });

            add("com.optionfair.client.model.Option/1343902663", {
				fstr("serialuid"),
                fint("assetId"), // Для какой пары текущий опцион
                fstd("some_2"),
                fint("optionSeconds"),
                fstd("some_4"),
				fint("some_5"),
				fptr("closeDate"),
                fptr("some_7"),
                fint("expiryTypeId"),
                flng("id"),
                fdbl("some_10"),
                fint("instrumentId"),
                fstd("some_12"),
                fptr("some_13"),
                fdbl("some_14"),
                fdbl("some_15"),
                flng("some_16"),
                fint("some_17"),
                fint("some_18"),
                fint("some_19"),
                flng("some_20"),
				fstd("some_21"),
				fstd("some_22"),
				fint("some_23"),
				fint("return"),
				fstr("some_24"),
                fdbl("price"),
                fstd("some_26"),
                fptr("openFrom"),
				fint("some_int"),
				fptr("some_date"),
				fint("optionStatus"),
				fdbl("some_29"),
                fdbl("some_30"),
                fdbl("some_31"),
                fdbl("some_32"),
                flng("some_33"),
            });


/**
0
124
bVQI
7.679500e-01
311
0
6 [java.util.Date/3385151746]
Vo7NMsA
0.000000e+00
0.000000e+00
HUw
5 [com.optionfair.client.model.Option/1343902663]
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
ZN
0
0
0
170
7 [1]
7.679500e-01
0
0
0
6 [java.util.Date/3385151746]
Vo7NMsA
14
7.679500e-01
0.000000e+00
0.000000e+00
0.000000e+00
O
5 [com.optionfair.client.model.Option/1343902663]
5 [com.optionfair.client.model.Option/1343902663]
0
60
0
-1
6 [java.util.Date/3385151746]
Vo$o7MA
0
124
bVP2
1.252100e+00
311
0
6 [java.util.Date/3385151746]
Vo7NMsA
0.000000e+00
0.000000e+00
Opg
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
P_
0
0
0
170
7 [1]
1.252100e+00
0
0
0
6 [java.util.Date/3385151746]
Vo7NMsA
14
1.252100e+00
0.000000e+00
0.000000e+00
0.000000e+00
O
5 [com.optionfair.client.model.Option/1343902663]
14
0
60
0
-1
6 [java.util.Date/3385151746]
Vo9WhwA
0
124
bVTl
5.340500e+01
311
0
6 [java.util.Date/3385151746]
Vo7owXA
0.000000e+00
0.000000e+00
HUw
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
1 [com.optionfair.client.model.ClientUpdatePack/839029662]
Tr
0
0
0
165
7 [1]
5.340500e+01
0
0
0
6 [java.util.Date/3385151746]
Vo7oqgA
14
5.340500e+01
0.000000e+00
0.000000e+00
0.000000e+00
O
5 [com.optionfair.client.model.Option/1343902663]
4 [java.lang.Long/4227064769]
0
300
0
-1
6 [java.util.Date/3385151746] */

			add("com.optionfair.client.model.AssetCurrencyRel/2204523642", {
				fstr("serialuid"), //6[rO0ABXcEAAAAAA == ]
				fstd("some1"), //43[Wagered]
                fptr("pk"),
				fstd("std1"), //1[com.optionfair.client.model.LutResolverInitPackage / 2546929785]
				fstd("std2"), //1[com.optionfair.client.model.LutResolverInitPackage / 2546929785]
			});

            add("com.optionfair.client.model.AssetCurrencyRelPK/4186144263", {
                fint("some_id"), //43[Wagered]
            });

            add("com.optionfair.client.model.PositionUpdate/3887973789", {
                fdbl("closedPrice"),//0.000000e+00
                fptr("positionCloseDate"),//0
                flng("transactionId"),//KlvU
                fint("instrumentId"),//311
                flng("date"),//VRdvf30
                flng("returned"),//A
                flng("some_7"),//A
                fint("positionStatus"),//18
                fdbl("some_9"),//0.000000e+00
            });

            add("com.optionfair.client.model.AssetUpdate/3263927368", {
				fstr("serialuid"), //6[rO0ABXcEAAAAAA == ]
				fint("assetStatusId"), // статус лота (нужен Production)
                fint("assetId"), // Идентификатор лота
                fdbl("targetPrice"), // Текущая цена
            });

            add("com.optionfair.client.model.OptionUpdateChangeStrike/3365438592", {
                fdbl("targetPrice"),
                fdbl("some_2"),
                flng("optionId"),
                fdbl("some_4"),
                fdbl("some_5"),
                fint("optionStatus"),
            });

			add("com.optionfair.client.resolver.BrandCurrencyCountryResolver/4149870428", {
                fptr("countries"),
                fptr("currencies"),
                fptr("currencyMap"),
                fstd("some_1"),
			});

            add("com.optionfair.client.model.LutResolverInitPackage/2546929785", {
                fptr("pspToPspType"),
                fptr("lutTypes"),
                fptr("paymentMethods"),
                fptr("assets"),
                fptr("someToPspCcTypeRels"),
                fptr("some_3"),
                fptr("blackWhiteList"),
                fptr("someList1"),
                fptr("brand"),
                fptr("brandCurrencyCountryResolver"),
                fstd("externalId"),
                fstd("some_5"),
                fstr("enfinium"),
                fptr("breandPspRels"),
                fptr("some_8"),
                fptr("brandRegulations"),
                fptr("primaryCurrencies"),
                fptr("limits"),
                fstd("basic"),
                fptr("date"),
                fptr("primaryDateFormat"),
                fstd("some_10"),
                fstd("some_11"),
                fptr("instrumentTypeFilters"),
                fptr("instrumentTypeSuperToInstrumentTypes"),
                fptr("instrumentTypeToInstrument"),
                fptr("superRels"),
                fstd("some_15"),
                fstd("some_16"),
                fstd("num_99999"),
                fptr("LoginDTO"),
                fstd("some_19"),
                fptr("markets"),
                fptr("messages"),
                fstd("some_20"),
                fptr("servers"),
                fptr("acceptedMethods"),
                fptr("pspCcTypeRels"),
                fstd("some_21"),
                fptr("some_22"),
                fptr("states"),
                fptr("some_23"),
                fptr("trackingInfo"),
                fptr("verifications"),
                fstd("some_24"),
                fstd("some_25")
            });

            add("com.optionfair.client.model.TradeLimits/516060049", {
                flng("some_1"),
                flng("some_2"),
                flng("some_3")
            });

            add("com.optionfair.client.ui.pages.tradePage.spread.High/1043352957", {
                fstr("some_1"),
                fdbl("some_2")
            });

			add("com.optionfair.client.ui.pages.tradePage.spread.NoSpread/2332320922", {
				//fint("some_1"),
				//fint("some_2"),
			});

            add("com.optionfair.client.ui.pages.tradePage.spread.Low/1807028581", {
                fstr("some_1"),
                fdbl("some_2")
            });

            add("com.optionfair.client.ui.pages.tradePage.spread.Touch/1022019549", {
                fstr("some_1"),
                fdbl("some_2")
            });

            add("com.optionfair.client.ui.pages.tradePage.spread.NoTouch/1845245280", {
                fstr("some_1"),
                fdbl("some_2")
            });

            add("com.optionfair.client.ui.pages.tradePage.spread.In/3813998762", {
                fstr("some_1"),
                fdbl("some_2")
            });

            add("com.optionfair.client.ui.pages.tradePage.spread.Out/2494560053", {
                fstr("some_1"),
                fdbl("some_2")
            });

            add("com.optionfair.client.ui.pages.tradePage.spread.Probability/1287790398", {
                fstr("some_1"),
                fdbl("some_2"),
            });

            add("com.optionfair.client.model.LoginDTO/3023568058", {
                fptr("account"),
                fstr("login"),
                fstr("some_1"),
                fptr("someMap"),
                fstd("some_2"),
                fstd("some_3"),
                fdbl("some_4"),
                fint("some_5"),
                fstd("some_6"),
                fptr("tradeLimits"),
                fstd("some_8"),
                fstd("some_9")
            });

            add("com.optionfair.client.spread.SpreadCalculator/3758543021", {
                flng("some_1"),
                fdbl("some_2"),
                fdbl("some_3"),
                fdbl("some_4"),
                fdbl("some_5"),
                fptr("spreads"),
                fstd("some_6"),
                fstd("some_7"),
                fdbl("some_8"),
                fdbl("some_9"),
                fstd("some_10"),
                fint("some_11"),
                fstd("some_12"),
                fstd("some_13"),
                fstd("some_14"),
                flng("some_15"),
                fstd("some_16"),
            });



            add("com.optionfair.client.model.Account/3668294554", {
                fstr("serialuid"),
                fstd("some_1"),
                fstr("regular"),
                fint("some_2"),
                fstd("some_3"),
                flng("some_4"),
                fstd("some_5"),
                fstd("some_6"),
                fstd("some_7"),
                fstd("some_8"),
                fstd("some_9"),
                flng("some_10"),
                flng("some_11"),
                fptr("some_date"),
                fptr("someList_1"),
                fptr("someList_2"),
                fdbl("some_12"),
                fint("externalId"),
                fptr("integer_1"),
                fstd("some_13"),
                fstd("some_14"),
                fint("some_15"),
                fstr("gotham"),
                fstr("guid"),
                fstr("name"),
                fstr("how"),
                fstd("some_16"),
                fstd("some_17"),
                fstr("email"),
                fstd("some_18"),
                fstr("login"),
                fstd("some_19"),
                fstr("fullName"),
                flng("some_20"),
                fstd("some_21"),
                flng("accountId"),
                fstd("some_23"),
                fstd("some_24"),
                fstd("some_25"),
                fstd("some_26"),
                fstd("some_27"),
                fstd("some_28"),
                fstd("some_29"),
                fstd("some_30"),
                fstd("some_31"),
                fstd("some_32"),
                fptr("lastVisit"),
                fstr("shortName"),
                fstd("some_33"),
                fstd("some_34"),
				fstd("some_345"),
                flng("some_35"),
                fstd("some_36"),
                flng("some_37"),
                flng("some_38"),
                flng("some_39"),
                fstd("some_40"),
                fstd("some_41"),
                fstd("some_42"),
                fstd("some_43"),
                fstd("some_44"),
                fstd("some_45"),
                fstd("some_46"),
                fstr("some_47"),
                fstd("some_48"),
                fptr("joinDate"),
                flng("some_49"),
                fint("some_50"),
                fptr("integer_2"),
                fstd("some_51"),
                fint("some_52"),
                fint("some_53"),
                flng("some_54"),
                fstd("some_55"),
                fstd("some_56"),
                fptr("some_57"),
                fstr("answer"),
                fstr("questing"),
                fstd("some_58"),
                fint("some_59"),
                fint("some_60"),
                fstr("some_61"),
				fstd("some_615"),
                fdbl("some_62"),
                fptr("spreadCalculator"),
                fstd("some_63"),
                fstd("some_64"),
                flng("some_65"),
            });

            add("com.optionfair.client.model.TrackingInfo/2864454600", {
                fstr("serialuid"),
                fstd("some_1"),
                flng("some_2"),
                flng("some_3"),
                fstd("some_4"),
                fstd("some_5"),
                fstd("some_6"),
                fstd("some_7"),
                fstd("some_8"),
                fstd("some_9"),
                flng("some_10"),
                fptr("date")
            });


            add("com.optionfair.client.verification.FieldVerification/2630919542", {
                fstd("some_1"),
                fstd("some_2"),
                fstd("some_3"),
                fstd("some_4"),
                fstd("some_5"),
                fint("some_6"),
                fstd("some_7"),
                fstr("name"),
                fstd("some_8"),
                fstr("regex"),
                fstd("some_9"),
                fstd("some_10")
            });

            add("com.optionfair.client.verification.FieldVerification/2808143106", {
                fstd("some_1"),
                fstr("some_2"),
                fstd("some_3"),
                fstd("some_4"),
                fstd("some_5"),
                fint("some_6"),
                fstd("some_7"),
                fstd("some_8"),
                fstr("name"),
                fstd("some_9"),
                fstr("regex"),
                fstd("some_10"),
                fstd("some_11"),
                fstd("some_12")
            });

            add("com.optionfair.client.model.State/1216850312", {
                fstr("serialuid"),
                fstd("country"),
                fint("order"),
                fstr("some_1"),
                fstr("name")
            });

            add("com.optionfair.client.model.PspCcTypeRel/300072509", {
                fstr("serialuid"),
                fint("creditCardTypeId"),
                flng("id"),
                fint("paymentMethodTypeId")
            });

            add("com.optionfair.client.model.MTServer/2069697836", {
                fstd("some_1"),
                fstd("some_2"),
                fstr("name")
            });

            add("com.optionfair.client.model.SubMarket/2699240068", {
                fstr("serialuid"),
                fstd("some_1"),
                fint("id"),
                fint("some_2"),
                fint("some_3"),
                fstr("name"),
                fint("some_4")
            });

            add("com.optionfair.client.model.Market/3553066736", {
                fstr("serialuid"),
                fint("id"),
                fint("some_2"),
                fstr("name"),
                fptr("subMarkets"),
                fstd("some_3"),
                fptr("parameters")
            });

            add("com.optionfair.client.model.InstrumentTypeFilter/1437805786", {
                fstr("serialuid"),
                fstd("some_1"),
                fstr("interval"),
                fint("order"),
                fstd("some_2"),
                fstr("title")
            });

            add("com.optionfair.client.model.InstrumentTypeInstrumentTypeSuperRel/1928340203", {
                fstr("serialuid"),
                fint("some_1"),
                fint("id"),
                fint("instrumentTypeId"),
                fint("instrumentTypeSuperId"),
                fint("order")
            });

            add("com.optionfair.client.model.CurrencyCountryLimit/3396769176", {
                fstr("serialuid"), // 6 [rO0ABXcEAAAAAA==]
                fstd("externalId"), // 37 [Admin]
                fstd("some_2"), // 1043 [XX]
                fint("currencyId"), // 1 [com.optionfair.client.model.LutResolverInitPackage/2546929785]
                fint("order"), // 1 [com.optionfair.client.model.LutResolverInitPackage/2546929785]
                fstd("some_3"), // 0
                flng("some_4"), // MNQ
                flng("some_5"), // B6Eg
                flng("some_6"), // MNQ
                flng("some_7"), // Ek$A
                flng("some_8"), // MNQ
                flng("some_9"), // MNQ
                flng("some_10"), // TEtA
                flng("some_11"), // MNQ
                flng("some_12"), // MNQ
                flng("some_13"), // D0JA
                flng("some_14"), // Yag
                flng("some_15"), // D0JA
                flng("some_16"), // HoSA+
                flng("some_17"), // Po
                flng("some_18"), // CcQ
                flng("some_19"), // Po
                flng("some_20"), // BOI
                flng("some_21"), // E4g
                flng("some_22"), // Po
                flng("some_23"), // Po
                flng("some_24"), // Po
				flng("some_25"), // Po
				flng("some_26"), // D0JA
                flng("some_27"), // D0JA
                flng("some_28"), // CcQ
			});

            add("com.optionfair.client.model.Currency/2484116626", {
                fstr("serialuid"),
                fint("id"),
                fstr("name"),
                fstr("symbol"),
                fstd("some_1"),
                fint("countryId"),
                fdbl("some_3"),
                fstd("some_4"),
                fstr("some_5"),
                fstr("abbr"),
                fstd("some_6"),
                flng("some_7")
            });

            add("com.optionfair.client.model.BreandPspRel/2784143874", {
                fstr("serialuid"),
                fint("externalId"),
                fstd("some_1"),
                fstd("some_2"),
                fstd("some_3"),
                fstd("some_4"),
                fstd("some_5"),
                fstd("some_6"),
                fstd("some_7"),
                fstd("some_8"),
                fstd("some_9"),
                fstd("some_10"),
                fstd("some_11")
            });

            add("com.optionfair.client.model.BrandRegulation/1013124097", {
                fstr("serialuid"), // 6 [rO0ABXcEAAAAAA==]
                fint("externalId"), // 37 [Admin]
                fstd("some_1"), // 1 [com.optionfair.client.model.LutResolverInitPackage/2546929785]
                fstd("some_2"), // 1680 [Swaziland]
                fstd("some_3"), // 1502 [PSE]
                fstd("some_4"), // 2800
                fstd("some_5"), // 0
                fstd("some_6"), // 3 [java.lang.Integer/3438268394]
                fstd("some_7"), // 3000
                fstd("some_8"), // 2000
                fstd("some_9"), // 1675 [SJM]
                fptr("some_10"), // -4104
                fstd("some_11"), // 141 [RU]
            });



			add("com.optionfair.client.model.DateTimeFormatOF/3059496483", {
				fstr("serialuid"),
				fstr("full_date"),
				fstr("mid_date"),
				fstr("short_date"),
				fstr("very_short"),
				fstd("some_1"),
				fstr("full_time"),
				fstr("mid_time"),
				fstr("short_time")
			});

            add("com.optionfair.client.model.Country/2926175992", {
                fstr("serialuid"),
                fptr("dateTimeFormat"),
                fstd("some_2"),
                fstd("language"),
                fint("some_3"),
                fint("some_4"),
                fstr("short_2"),
                fstr("short_3"),
                fstr("fullName"),
                fint("some_5"),
                fstr("some_6"),
                fstr("some_7")
            });

            add("com.optionfair.client.model.Asset/2513088007", {
				fstr("serialuid"),
				fdbl("some_1"),
				fdbl("some_2"),
				fdbl("some_3"),
				fstd("some_4"),
				fstd("some_5"),
				fdbl("some_6"),
				fstr("some_7"),
				fstd("some_8"),
				fdbl("some_9"),
				fint("some_10"),
				fint("some_11"),
				fint("id"),
				fdbl("some_13"),
				fint("some_14"),
				fint("some_15"),
				fptr("some_16"),
				fint("some_17"),
				fdbl("some_18"),
				fstd("some_19"),
				fstd("some_20"),
				fstd("some_21"),
				fint("some_22"),
				fdbl("some_225"),
				fint("some_23"),
				fint("some_24"),
				fdbl("some_25"),
				fint("some_26"),
				fdbl("some_27"),
				fstd("some_28"),
				fint("some_29"),
				fint("some_30"),
				fstd("some_31"),
				fint("subMarketId"),
				fstd("some_33"),
				fstr("name"),
				fstr("some_35"),
				fstr("some_36"),
				fstd("some_37"),
				fstr("some_375"),
				fdbl("some_38")
			});

            add("com.optionfair.client.model.LutType/4271068468", {
                fstr("serialuid"),
                fint("id"),
                fstr("name"),
                fptr("luts"),
                fstd("some_1"),
                fptr("parameters")
            }, "name");

            add("com.optionfair.client.model.Lut/3629739227", {
                fstr("serialuid"),
                fint("id"),
                fstr("name"),
                fint("lutTypeId")
            }, "name");

			add("com.optionfair.client.model.PaymentMethod/4059381229", {
				fstr("serialuid"),//6 [rO0ABXcEAAAAAA==]
				fint("commissionType"),//128 [UpBid]
				fdbl("some_2"),//3.000000e+02
				fint("id"),//93 [Tax]
				fint("some_4"),//1 [com.optionfair.client.model.LutResolverInitPackage/3212179674]
				fstd("some_5"),//0
				fint("some_6"),//8 [com.optionfair.client.model.Lut/3629739227]
				fstr("some_7"),//204 [Wire]
				fstd("some_8"),//0
				fstd("some_9"),//0
				fint("some_10"),//1 [com.optionfair.client.model.LutResolverInitPackage/3212179674]
				fint("regulationId"),//1502
				fstd("some_12"),//0
				fstd("some_13"),//267 [IdPay_cysec]
			});
			
			add("com.optionfair.client.model.TradeActionResponse/2831172712", {
                flng("accountId"), //ISw
                fint("some_2"),//0
                flng("money"),//Po
                fint("some_4"),//4
                fdbl("some_5", true),//0
				flng("some_55"),
                fdbl("some_6"),//1.13335
                fint("some_7"),//0
				fint("some_75"),//0
				fstr("some_8"),//2 [ACR+yRO4lkJ3cjauwhbeAQ==]
                fdbl("some_9", true),//0
                fint("some_10"),//1 [com.optionfair.client.model.TradeActionResponse/3233850074]
                flng("some_11"),//Xm$s
                fint("positionType"),//49
                flng("some_13"),//A
                fstr("some_14"),//3 [0]
                fdbl("some_15"),//1.13335
                fstr("some_16"),//4 [1.13335]
                fint("some_17"),//0
                flng("purchasedAt"),//VRdvfvC
                fint("some_19"),
				fint("some_20")
            });

            add("com.optionfair.client.model.Brand/160541779", {
                fstr("serialuid"),//        "6 [rO0ABXcEAAAAAA==]\n"
                fstr("some_1"), //        "778 [/]\n"
                fdbl("some_2"), //        "1.500000e+00\n"
                fint("some_3"), //        "1 [com.optionfair.client.model.LutResolverInitPackage/2546929785]\n"
                fint("some_4"), //        "0\n"
                fint("some_5"), //        "2835\n"
                fint("some_6"), //        "0\n"
                flng("some_7"), //        "Yag\n"
                fint("some_8"), //        "320 [Fee]\n"
                fint("some_9"), //        "0\n"
                fstr("some_10"), //        "776 [basic]\n"
                fint("some_11"), //        3 [java.lang.Integer/3438268394]\n"
                flng("some_12"), //        "MNQ\n"
                fint("some_13"), //        "0\n"
                flng("some_14"), //        "Yag\n"
                fstd("some_15"), //        "595 []\n"
                fstd("some_16"), //        "37 [Admin]\n"
                fstr("domain"), //        "779 [.*vantagefx.com]\n"
                fint("some_17"), //        "1 [com.optionfair.client.model.LutResolverInitPackage/2546929785]\n"
                fint("some_18"), //       "0\n"
                fint("some_19"), //        "1 [com.optionfair.client.model.LutResolverInitPackage/2546929785]\n"
                fint("some_20"), //        "0\n"
                fint("some_21"), //        "99999\n"
                fstr("some_22"), //        "780 [Enfinium]\n"
                fstd("some_23"), //        "10 [Mrs.]\n"
                fdbl("some_24"), //        "0.000000e+00")
                fptr("operator")
            });
            add("com.optionfair.client.model.Operator/1111544044", {
                fstr("serialuid"),//        "6 [rO0ABXcEAAAAAA==]\n"
                fptr("some_1"),
                fint("some_2"),
                fstr("some_3"),
                fint("some_4"),
                fint("some_5"),
                fptr("some_6"),
                fint("some_7"), //  1650
                fstr("some_8"), //  37 [Admin]
                fstr("some_9"), //  788 [none]
                fstr("some_10"),//  789 [http://nihul.4xp.com/digital_options/soap_do.php?wsdl]
                fint("some_11"), //                    1640
                fdbl("some_12"), //                    0.000000e+00
                fint("some_13"), //                    1666
                fdbl("some_14"), //                    1.500000e-01
                fdbl("some_15"), //                    2.000000e-01
                fint("some_16"), //                    1
                fptr("some_17"), //                    0
                fint("some_18"), //                    1
                fint("some_19"), //                    1
                fint("some_20"), //                    0
                fdbl("some_21"), //                    0.000000e+00
                fstd("some_22"), //                    77 [TransactionType]
                fdbl("some_23"), //                    0.000000e+00
                fstr("some_24"), //                    790 [0]
                fint("some_25"), //                    1 [com.optionfair.client.model.LutResolverInitPackage/2546929785]
                fint("some_26"), //                    0
                fint("some_27"), //                    0
                fint("some_28"), //                    0
                fint("some_29"), //                    0
                fint("some_30"), //                    0
            });

            add("com.optionfair.client.model.Position/1677341959", {
                fstr("serialuid"),//2 [rO0ABXcEAAAAAA==]
                flng("accountId"),//ISw
                fint("some_2"),//0
                flng("bet"),//Po
                flng("some_4"),//A
                fdbl("some_5"),//0.000000e+00
                fint("some_6"),//0
                fptr("some_7"),//0
                fdbl("some_8"),//0.000000e+00
                fdbl("some_9"),//0.000000e+00
                fptr("expiryDate"),//3 [java.util.Date/3385151746]
                flng("some_10"),//A
                flng("transactionId"),//KlvU
                flng("some_12"),//Po
                fint("some_13"),//1 [com.optionfair.client.model.Position/1677341959]
                fint("some_14"),//0
                fptr("openDate"),//3 [java.util.Date/3385151746]
                fstr("some_15"),//0
                flng("some_16"),//L2
                flng("some_17"),//L2
                flng("some_18"),//A
                flng("some_19"),//A
                fint("some_20"),//1 [com.optionfair.client.model.Position/1677341959]
                fint("positionOpenType"),//264
                fptr("option"),
                fptr("some_date_3"),
                fint("some_22"),
                fint("positionType"),//49
                flng("some_24"),//A
                flng("some_25"),//A
                fint("some_26"),//0
                fint("some_27"),//0
                flng("some_28"),//A
                flng("some_29"),//A
                fdbl("some_30"),//1.133350e+00
                fint("positionStatus"),//18
                fdbl("some_32"),//0.000000e+00
                fdbl("some_33"),//1.133350e+00
                fdbl("some_34"),//0.000000e+00
                fdbl("some_35"),//0.000000e+00
                fdbl("some_36"),//1.133350e+00
                fint("some_37"),//0
                fdbl("some_38"),//0.000000e+00
                flng("some_39"),//U7fV
                fdbl("some_40"),//0.000000e+00
            });

            add("com.optionfair.client.messages.MapMessageSource/3864621178", {
                    fptr("value")
            }, "value");

            add("net.sf.gilead.pojo.gwt.collection.ListParameter/3890945144", {
                    fptr("value")
            }, "value");

            add("net.sf.gilead.pojo.gwt.collection.MapParameter/1940144086", {
                    fptr("value")
            }, "value");

            add("net.sf.gilead.pojo.gwt.basic.IntegerParameter/3421404974", {
                    fptr("value")
            }, "value");

            add("net.sf.gilead.pojo.gwt.basic.StringParameter/2783524083", {
                    fstr("value")
            }, "value");

            add("net.sf.gilead.pojo.gwt.GwtSerializableId/2844303195", {
                    fstr("entityName"),
                    fptr("id"),
                    fstr("stringValue")
            });


            add(std::make_shared<GwtListType>("java.util.ArrayList/4159755760"));
            add(std::make_shared<GwtListType>("java.util.LinkedList/3953877921"));
            add(std::make_shared<GwtListType>("java.util.HashSet/3273092938"));
            add(std::make_shared<GwtMapType>("java.util.HashMap/1797211028", 0));
            add(std::make_shared<GwtMapType>("java.util.LinkedHashMap/3008245022", 1));
			add("java.lang.Integer/3438268394", { fint("value") }, "value");
			add("com.optionfair.client.luts.Instrument/2210327378", { fint("value") }, "value");
			add("java.lang.Long/4227064769", { flng("value") }, "value");
			add("java.lang.String/2004016611", { fstr("value") }, "value");
			add("java.util.Date/3385151746", { fdte("value") }, "value");
            add("java.lang.Double/858496421", { fdbl("value") }, "value");
        }
Esempio n. 30
0
// 
// メインプログラム
// 
int main() {
	// アプリウインドウの準備
	AppEnv app_env(Window::WIDTH, Window::HEIGHT);

	// ハイスコア
	int hi_score = 0;
	{
		std::ifstream fstr("score.txt");
		if (fstr){
			fstr >> hi_score;
		}
	}
	// 結果画面からタイトル画面に戻るループ
	while (1){
		// 背景を動かす変数
		float scroll_back = 0;
		// 飛距離
		int jump_distance = 0;

		// タイトル画面
		{
			// タイトル画像
			Texture title_image("res/title_back.png");
			Texture title_rogo("res/title.png");
			Texture GAMESTART("res/GAME START.png");

			// 「Run and Jump」演出用変数を用意
			float title_angle = 0.0;
			int blink = 0;
			// メインループ
			while (1) {
				// ウィンドウが閉じられたらアプリを終了
				if (!app_env.isOpen()) return 0;

				// 描画準備
				app_env.setupDraw();

				// 入力による操作(break本編へ,returnアプリ終了)
				if (app_env.isPushButton(Mouse::RIGHT)) break;
				if (app_env.isPushButton(Mouse::LEFT))  break;
				if (app_env.isPushKey(GLFW_KEY_ENTER))  break;
				if (app_env.isPushKey(GLFW_KEY_ESCAPE)) return 0;

				// タイトル画像
				drawTextureBox(0 - 2048 / 2, 0 - 1024 / 2, 2048, 1024,
					0, 0, 2048, 1024,
					title_image,
					Color(1, 1, 1));

				// タイトルロゴの色にサイン,コサインを利用
				title_angle += 0.05;
				float title_sin = std::abs(std::sin(title_angle));
				float title_cos = std::abs(std::cos(title_angle));

				// タイトルロゴを表示
				drawTextureBox(0 - 1024 / 2, 512 / 2, 565, 80,
					0, 512, 565, 80,
					title_rogo,
					Color(0, title_sin, title_cos),
					0,
					Vec2f(2, 2),
					Vec2f(0, 0));

				// 「GAME START」を表示
				blink += 1;
				int value = (blink / 30) % 2;

				if (value){
					drawTextureBox(0 - 360, 0 - 480, 512, 256,
						0, 0, 512, 256,
						GAMESTART,
						Color(1, 0, 0),
						0,
						Vec2f(1.8, 1.8),
						Vec2f(0, 0));
				}
				// 画面を更新
				app_env.update();
			}
			// 入力のフラッシュ
			app_env.flushInput();
		}
		// 操作説明画面
		{
		// 操作説明画像
		Texture tutorial("res/tuto.png");
		Texture back("res/field.png");

		// メインループ
		while (1) {
			// ウィンドウが閉じられたらアプリを終了
			if (!app_env.isOpen()) return 0;

			// 描画準備
			app_env.setupDraw();

			// 入力による操作(break本編へ,returnアプリ終了)
			if (app_env.isPushButton(Mouse::RIGHT)) break;
			if (app_env.isPushButton(Mouse::LEFT))  break;
			if (app_env.isPushKey(GLFW_KEY_ENTER))  break;
			if (app_env.isPushKey(GLFW_KEY_ESCAPE)) return 0;

			// 操作説明画面
			drawTextureBox(0 - 2048 / 2, 0 - 1024 / 2, 2048, 1024,
				0, 0, 2048, 1024,
				back,
				Color(1, 1, 1));

			drawTextureBox(0 - 2048 / 2, 0 - 1024 / 2, 2048, 1024,
				0, 0, 2048, 1024,
				tutorial,
				Color(1, 1, 1));

			// 画面を更新
			app_env.update();

			// 入力のフラッシュ
			app_env.flushInput();
		}

		// 本編
		{
			// 本編の画像
			Texture back("res/field.png");
			Texture run("res/run.png");
			Texture jump("res/jump.png");
			Texture back2("res/field2.png");
			Texture back3("res/field3.png");
			Texture dispnumber("res/number.png");

			int blink = 0;
			// キャラの表示位置
			float x = 0 - 1024 / 1.5;
			float y = 0 - 380;
			// キャラの加速度
			float a = 0;
			// 重力加速度
			float g = -0.2;
			// キャラの速度
			float v = 0;
			// キャラのジャンプ回数
			int jump_count = 3;
			// キャラのジャンプスイッチ
			int jump_switch = 0;

			// メインループ
			while (1){
				// ウインドウが閉じられたら終了
				if (!app_env.isOpen()) return 0;
				if (app_env.isPushKey(GLFW_KEY_ESCAPE)) return 0;

				// 描画準備
				app_env.setupDraw();

				// キャラクターのモーション情報
				struct Texture {
					// 画像からの切り抜き情報
					float texture_x, texture_y;
					float texture_width, texture_height;
				};

				// キャラクターの情報を配列で用意
				Texture move_info[] = {
					{ 0 * 100, 0, 100, 150 },
					{ 1 * 100, 0, 100, 150 },
					{ 2 * 100, 0, 100, 150 },
					{ 3 * 100, 0, 100, 150 },
					{ 4 * 100, 0, 100, 150 },
					{ 5 * 100, 0, 100, 150 },
					{ 6 * 100, 0, 100, 150 },
				};

				// 数字の情報を配列で用意
				Texture number_info[] = {
					{ 0 * 50, 0, 29, 55 },
					{ 1 * 50, 0, 48, 54 },
					{ 2 * 50, 0, 44, 55 },
					{ 3 * 50, 0, 45, 54 },
					{ 4 * 50, 0, 47, 54 },
					{ 5 * 50, 0, 43, 55 },
					{ 6 * 50, 0, 43, 54 },
					{ 7 * 50, 0, 45, 55 },
					{ 8 * 50, 0, 43, 55 },
					{ 9 * 50, 0, 38, 57 },
				};

				// キャラクターの情報を配列から取り出す
				Texture move_chara1 = move_info[0];
				Texture move_chara2 = move_info[1];
				Texture move_chara3 = move_info[2];
				Texture move_chara4 = move_info[3];
				Texture move_chara5 = move_info[4];
				Texture move_chara6 = move_info[5];
				Texture move_chara7 = move_info[6];

				Texture disp_num1 = number_info[0];
				Texture disp_num2 = number_info[1];
				Texture disp_num3 = number_info[2];
				Texture disp_num4 = number_info[3];
				Texture disp_num5 = number_info[4];
				Texture disp_num6 = number_info[5];
				Texture disp_num7 = number_info[6];
				Texture disp_num8 = number_info[7];
				Texture disp_num9 = number_info[8];
				Texture disp_num0 = number_info[9];

				// ゲーム本編
				{
					
					// キャラクター処理
					{
						// 本編背景を連ねて表示に必要な変数
						int draw_back = 0;
						float num_x = -Window::WIDTH / 2 + 50;
						float num_y = -Window::HEIGHT / 2 + 25;

						// 本編画像を表示					
						draw_back += 2000;

						if (app_env.isPressKey(GLFW_KEY_RIGHT)){
							scroll_back += 20;
						}

						drawTextureBox(0 - 2048 / 2 - scroll_back, 0 - 1024 / 2,
							2048, 1024,
							0, 0,
							2048, 1024,
							back,
							Color(1, 1, 1));

						drawTextureBox(0 - 2048 / 2 - scroll_back + 2000, 0 - 1024 / 2,
							2048, 1024,
							0, 0,
							2048, 1024,
							back,
							Color(1, 1, 1));

						drawTextureBox(0 - 2048 / 2 - scroll_back + 4000, 0 - 1024 / 2,
							2048, 1024,
							0, 0,
							2048, 1024,
							back2,
							Color(1, 1, 1));

						drawTextureBox(0 - 2048 / 2 - scroll_back + 6000, 0 - 1024 / 2,
							2048, 1024,
							0, 0,
							2048, 1024,
							back3,
							Color(1, 1, 1));

						drawTextureBox(0 - 2048 / 2 - scroll_back + 8000, 0 - 1024 / 2,
							2048, 1024,
							0, 0,
							2048, 1024,
							back3,
							Color(1, 1, 1));

						drawTextureBox(0 - 2048 / 2 - scroll_back + 10000, 0 - 1024 / 2,
							2048, 1024,
							0, 0,
							2048, 1024,
							back3,
							Color(1, 1, 1));

						// キャラをジャンプさせる
						if (app_env.isPushKey(GLFW_KEY_SPACE) && jump_count > 0){
							a = 10 + g;
							jump_count--;
							jump_switch = 1;
						}
						else{
							a = g;
						}
						v = v + a;
						y = y + ((1 / 2) * a) + v;

						if (y < (0 - 380)) {
							v = 0;
							y = 0 - 380;
							// キャラが飛んでから地面に足をついたら結果画面へ
							if (jump_switch == 1 && y <= 0 - 380){
								break;
							}
						}

						// キャラが画面上端を超えたら止める
						if (y >= 512 - 200){
							y = 512 - 200;
							v = 0;
						}

						// キャラを表示
						if (app_env.isPressKey(GLFW_KEY_RIGHT)){
							blink += 1;
						}
						int value = (blink / 3) % 7;

						drawTextureBox(x, y, move_info[value].texture_width, move_info[value].texture_height,
							move_info[value].texture_x, move_info[value].texture_y,
							move_info[value].texture_width, move_info[value].texture_height,
							run,
							Color(0, 0, 0),
							0,
							Vec2f(1.5, 1.5),
							Vec2f(0, 0));
						

						// 飛距離を表示する
						if (scroll_back >= 3250 - x && jump_count >= 0){
							jump_distance = (scroll_back - 4100) / 20;
						}
						// 線を越えても飛んでなかったらファウル
						if (scroll_back >= 3300 - x && jump_count == 3){
							jump_distance = 0;
							break;
						}

						// 100の位
						if (jump_distance >= 100){
							int hundred_distance = jump_distance / 100;
							if (hundred_distance != 0){
								drawTextureBox(num_x, num_y, number_info[hundred_distance - 1].texture_width, number_info[hundred_distance - 1].texture_height,
									number_info[hundred_distance - 1].texture_x, number_info[hundred_distance - 1].texture_y,
									number_info[hundred_distance - 1].texture_width, number_info[hundred_distance - 1].texture_height,
									dispnumber,
									Color(1, 1, 1),
									0,
									Vec2f(3, 3),
									Vec2f(0, 0));
							}
							if (hundred_distance == 0){
								drawTextureBox(num_x, num_y, number_info[9].texture_width, number_info[9].texture_height,
									number_info[9].texture_x, number_info[9].texture_y,
									number_info[9].texture_width, number_info[9].texture_height,
									dispnumber,
									Color(1, 1, 1),
									0,
									Vec2f(3, 3),
									Vec2f(0, 0));
							}
						}
						// 10の位
						if (jump_distance >= 10){
							int ten_distance = jump_distance % 100 / 10;
							if (ten_distance != 0){
								drawTextureBox(num_x + 120, num_y, number_info[ten_distance - 1].texture_width, number_info[ten_distance - 1].texture_height,
									number_info[ten_distance - 1].texture_x, number_info[ten_distance - 1].texture_y,
									number_info[ten_distance - 1].texture_width, number_info[ten_distance - 1].texture_height,
									dispnumber,
									Color(1, 1, 1),
									0,
									Vec2f(3, 3),
									Vec2f(0, 0));
							}
							if (ten_distance == 0){
								drawTextureBox(num_x + 120 , num_y, number_info[9].texture_width, number_info[9].texture_height,
									number_info[9].texture_x, number_info[9].texture_y,
									number_info[9].texture_width, number_info[9].texture_height,
									dispnumber,
									Color(1, 1, 1),
									0,
									Vec2f(3, 3),
									Vec2f(0, 0));
							}
						}
						// 1の位
						if (jump_distance >= 1){
							int one_distance = jump_distance % 10;
							if (one_distance != 0){
								drawTextureBox(num_x + 240, num_y, number_info[one_distance - 1].texture_width, number_info[one_distance - 1].texture_height,
									number_info[one_distance - 1].texture_x, number_info[one_distance - 1].texture_y,
									number_info[one_distance - 1].texture_width, number_info[one_distance - 1].texture_height,
									dispnumber,
									Color(1, 1, 1),
									0,
									Vec2f(3, 3),
									Vec2f(0, 0));
							}
							if (one_distance == 0){
								drawTextureBox(num_x + 240, num_y, number_info[9].texture_width, number_info[9].texture_height,
									number_info[9].texture_x, number_info[9].texture_y,
									number_info[9].texture_width, number_info[9].texture_height,
									dispnumber,
									Color(1, 1, 1),
									0,
									Vec2f(3, 3),
									Vec2f(0, 0));
							}
						}
					}
					// ハイスコア更新チェック
					if (jump_distance > hi_score){
						std::ofstream fstr("score.txt");
						if (fstr){
							fstr << jump_distance << std::endl;
							hi_score = jump_distance;
						}
					}

					// 画面を更新
					app_env.update();
				}
				// 入力のフラッシュ
				app_env.flushInput();
			}

			// 結果画面
			{
				Texture result("res/result.png");
				Texture back("res/field.png");
				Texture dispnumber("res/number.png");
				Texture Return("res/Return to Title");

				// メインループ
				while (1) {
					// ウィンドウが閉じられたらアプリを終了
					if (!app_env.isOpen()) return 0;

					float num_x = 0 - 25 / 2;
					float num_y_now = 0 - 30 / 2;
					float num_y_hi = 0 - 30 / 2 - 270;

					// 描画準備
					app_env.setupDraw();

					// 入力による操作(break本編へ,returnアプリ終了)
					if (app_env.isPushButton(Mouse::RIGHT)) break;
					if (app_env.isPushButton(Mouse::LEFT))  break;
					if (app_env.isPushKey(GLFW_KEY_ENTER))  break;
					if (app_env.isPushKey(GLFW_KEY_ESCAPE)) return 0;

					// 結果画面表示
					drawTextureBox(0 - 2048 / 2, 0 - 1024 / 2, 2048, 1024,
						0, 0, 2048, 1024,
						back,
						Color(1, 1, 1));

					drawTextureBox(0 - 2048 / 2, 0 - 1024 / 2, 2048, 1024,
						0, 0, 2048, 1024,
						result,
						Color(1, 1, 1));

					// 「Return to Title」を表示
					drawTextureBox(0 - 360, 0 - 480, 512, 256,
							0, 0, 512, 256,
							Return,
							Color(1, 0, 0),
							0,
							Vec2f(1.8, 1.8),
							Vec2f(0, 0));

					// 100の位
					if (jump_distance >= 100){
						int hundred_distance = jump_distance / 100;
						if (hundred_distance != 0){
							drawTextureBox(num_x, num_y_now, number_info[hundred_distance - 1].texture_width, number_info[hundred_distance - 1].texture_height,
								number_info[hundred_distance - 1].texture_x, number_info[hundred_distance - 1].texture_y,
								number_info[hundred_distance - 1].texture_width, number_info[hundred_distance - 1].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
						if (hundred_distance == 0){
							drawTextureBox(num_x, num_y_now, number_info[9].texture_width, number_info[9].texture_height,
								number_info[9].texture_x, number_info[9].texture_y,
								number_info[9].texture_width, number_info[9].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
					}
					// 10の位
					if (jump_distance >= 10){
						int ten_distance = jump_distance % 100 / 10;
						if (ten_distance != 0){
							drawTextureBox(num_x + 120, num_y_now, number_info[ten_distance - 1].texture_width, number_info[ten_distance - 1].texture_height,
								number_info[ten_distance - 1].texture_x, number_info[ten_distance - 1].texture_y,
								number_info[ten_distance - 1].texture_width, number_info[ten_distance - 1].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
						if (ten_distance == 0){
							drawTextureBox(num_x + 120, num_y_now, number_info[9].texture_width, number_info[9].texture_height,
								number_info[9].texture_x, number_info[9].texture_y,
								number_info[9].texture_width, number_info[9].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
					}
					// 1の位
					if (jump_distance >= 1){
						int one_distance = jump_distance % 10;
						if (one_distance != 0){
							drawTextureBox(num_x + 240, num_y_now, number_info[one_distance - 1].texture_width, number_info[one_distance - 1].texture_height,
								number_info[one_distance - 1].texture_x, number_info[one_distance - 1].texture_y,
								number_info[one_distance - 1].texture_width, number_info[one_distance - 1].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
						if (one_distance == 0){
							drawTextureBox(num_x + 240, num_y_now, number_info[9].texture_width, number_info[9].texture_height,
								number_info[9].texture_x, number_info[9].texture_y,
								number_info[9].texture_width, number_info[9].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
					}
					// ハイスコア
					// 100の位
					if (jump_distance >= 100){
						int hundred_distance = jump_distance / 100;
						if (hundred_distance != 0){
							drawTextureBox(num_x, num_y_hi, number_info[hundred_distance - 1].texture_width, number_info[hundred_distance - 1].texture_height,
								number_info[hundred_distance - 1].texture_x, number_info[hundred_distance - 1].texture_y,
								number_info[hundred_distance - 1].texture_width, number_info[hundred_distance - 1].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
						if (hundred_distance == 0){
							drawTextureBox(num_x, num_y_hi, number_info[9].texture_width, number_info[9].texture_height,
								number_info[9].texture_x, number_info[9].texture_y,
								number_info[9].texture_width, number_info[9].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
					}
					// 10の位
					if (jump_distance >= 10){
						int ten_distance = jump_distance % 100 / 10;
						if (ten_distance != 0){
							drawTextureBox(num_x + 120, num_y_hi, number_info[ten_distance - 1].texture_width, number_info[ten_distance - 1].texture_height,
								number_info[ten_distance - 1].texture_x, number_info[ten_distance - 1].texture_y,
								number_info[ten_distance - 1].texture_width, number_info[ten_distance - 1].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
						if (ten_distance == 0){
							drawTextureBox(num_x + 120, num_y_hi, number_info[9].texture_width, number_info[9].texture_height,
								number_info[9].texture_x, number_info[9].texture_y,
								number_info[9].texture_width, number_info[9].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
					}
					// 1の位
					if (jump_distance >= 1){
						int one_distance = jump_distance % 10;
						if (one_distance != 0){
							drawTextureBox(num_x + 240, num_y_hi, number_info[one_distance - 1].texture_width, number_info[one_distance - 1].texture_height,
								number_info[one_distance - 1].texture_x, number_info[one_distance - 1].texture_y,
								number_info[one_distance - 1].texture_width, number_info[one_distance - 1].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
						if (one_distance == 0){
							drawTextureBox(num_x + 240, num_y_hi, number_info[9].texture_width, number_info[9].texture_height,
								number_info[9].texture_x, number_info[9].texture_y,
								number_info[9].texture_width, number_info[9].texture_height,
								dispnumber,
								Color(1, 1, 1),
								0,
								Vec2f(3, 3),
								Vec2f(0, 0));
						}
					}

					// 画面を更新
					app_env.update();
				}
				// 入力のフラッシュ
				app_env.flushInput();
			}
		}
	}
		// アプリ終了
	}
}