Esempio n. 1
0
//------------------------------------------------------------------------------
/// \brief
//------------------------------------------------------------------------------
int ListReaderH5::GetSeawatAuxH5Idx (const char *a_name) const
{
  CStr name(a_name);
  name.MakeLower();
  std::map<CStr, int> aMap(iSeawatH5Idx());
  if (aMap.find(name) != aMap.end())
  {
    return aMap[name];
  }
  return -1;
} // ListReaderH5::GetSeawatAuxH5Idx
Esempio n. 2
0
File: main.c Progetto: zhuyadong/COS
int main(int argc, char **argv)
{
	cos_init();
	{
		OBJ map = aMap();
		I32 count = argc < 2 ? 33 : atoi(argv[1]);
		for (U32 i=0; i<count; ++i) {
			gputAt(map, aInt(i), aInt(i));
		}
		for (U32 i=0; i<count; i+=2) {
			gputAt(map, aInt(i), aInt(999999));
		}
		{
			I32 i555 = gint(ggetAt(map, aInt(30)));
			I32 i556 = gint(ggetAt(map, aInt(31)));
			printf("555=%d 556=%d\n", i555, i556);
		}
	}
	return 0;
}
void New_ForceInstanceNOMerge_AddAllCams()
{
    std::vector<cNewO_OneIm*> aVI;
    cStructMergeTieP< cFixedSizeMergeTieP<2,Pt2dr> > aMap(2,false);
    NOMerge_AddAllCams(aMap,aVI);
}
Esempio n. 4
0
int AddIn_main(int isAppli, unsigned short OptionNum)
{
	int xMap, yMap, newXMap, newYMap;
	unsigned char *light_buffer, *dark_buffer, *light_swap, *dark_swap, *tmp_swap;
	Map mapTest;

	//On initialise les buffer par calloc (plus propre que par allocation automatique!) : 
	light_buffer = calloc(1024, sizeof(unsigned char)); 
	dark_buffer = calloc(1024, sizeof(unsigned char));
	//Les deux buffers ci-dessous sont les "sawp" qui permettent de faire du double buffering
	// afin d'obtenir une meilleure fluiditée.
	light_swap = calloc(1024, sizeof(unsigned char));
	dark_swap = calloc(1024, sizeof(unsigned char));
	tmp_swap = 0;
	
    Bdisp_AllClr_DDVRAM();
	Change_Contrast (166);
	
	//On initialise le grayscale de revolution-fx :
	GrayLinkBuffers(light_buffer, dark_buffer);
	GrayInit(6987, 3269);
	
	//Allocation de la map :
	mapTest = aMap(m_votre_map);

	//Boucle principale d'execution :
    while(IsKeyUp (KEY_CTRL_EXIT)){
		if (IsKeyDown (KEY_CTRL_LEFT)) xMap-=2;
		if (IsKeyDown (KEY_CTRL_RIGHT)) xMap+=2;
		if (IsKeyDown (KEY_CTRL_UP)) yMap-=2;
		if (IsKeyDown (KEY_CTRL_DOWN)) yMap+=2;
		
		//On vérifie si on ne sort pas de la map :
		if (xMap<0) xMap=0;
		else if (xMap > (mapTest.width-128/mapTest.tileset.tileWidth)*mapTest.tileset.tileWidth) 
			xMap = (mapTest.width-128/mapTest.tileset.tileWidth)*mapTest.tileset.tileWidth;
			
		if (yMap<0) yMap=0;
		else if (yMap > (mapTest.height-64/mapTest.tileset.tileHeight)*mapTest.tileset.tileHeight) 
			yMap = (mapTest.height-64/mapTest.tileset.tileHeight)*mapTest.tileset.tileHeight;
		
		//On dessine la map sur les buffer de swap :
		drawMap (mapTest,
			xMap/mapTest.tileset.tileWidth,
			yMap/mapTest.tileset.tileHeight, 
			128/mapTest.tileset.tileWidth +1, 
			64/mapTest.tileset.tileWidth +1, 
			-(xMap % mapTest.tileset.tileWidth),
			-(yMap % mapTest.tileset.tileHeight),
			light_swap,
			dark_swap);
		
		//On inverse les buffer de swap avec les buffer principaux :
		GrayLinkBuffers(light_swap, dark_swap);
		tmp_swap = light_swap;
		light_swap = light_buffer;
		light_buffer = tmp_swap;
		tmp_swap = dark_swap;
		dark_swap = dark_buffer;
		dark_buffer = tmp_swap;
		//On efface les nouveaux buffer de swap :
		memset(light_swap, 0, 1024);
		memset(dark_swap, 0, 1024);
    }
	
	CPUSpeedNormal();
    Reset_Calc();
	return 1;
}