• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setLight函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setLight函数的典型用法代码示例。如果您正苦于以下问题:C++ setLight函数的具体用法?C++ setLight怎么用?C++ setLight使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setLight函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

void main(void)
{
	unsigned char light=0;
	unsigned char lastkey=0;			// Mark key to be off

	P0=~0x00;			// Light off

	for (;;)
	{
		if (getSwitch() == 1)
		{
			if (lastkey == 0)			// Switch is from Off to On
			{
				lastkey = 1;			// Mark switch is on now
				if (light == 0)			// Light is Off
				{
					setLight(1);		// Turn on the light now
					light = 1; 			// Mark light to On
				}
				else					// Light is on
				{
					setLight(0);  		// Turn off the light now
					light = 0;			// Mark light to Off
				}
			}	
		}
		else
		{
			lastkey = 0;				// Switch is off
		}
//		delay(30000);   				// for debug use
	}
} /* main */ 
开发者ID:ColorCatHouse,项目名称:MCU51_TestBench,代码行数:33,代码来源:sw001.c


示例2: setColorSpace

void KisColorSelector::loadSettings()
{
    KisConfig cfg;
    setColorSpace(KisColor::Type(cfg.readEntry<qint32>("ArtColorSel.ColorSpace" , KisColor::HSY)));
    
    setNumLightPieces(cfg.readEntry("ArtColorSel.LightPieces", 19));
    
    m_selectedColor.setH(cfg.readEntry<float>("ArtColorSel.SelColorH", 0.0f));
    m_selectedColor.setS(cfg.readEntry<float>("ArtColorSel.SelColorS", 0.0f));
    m_selectedColor.setX(cfg.readEntry<float>("ArtColorSel.SelColorX", 0.0f));
    m_selectedColor.setA(1.0f);
    
    setInverseSaturation(cfg.readEntry<bool>("ArtColorSel.InversedSaturation", false));
    setLight(cfg.readEntry<float>("ArtColorSel.Light", 0.5f), cfg.readEntry<bool>("ArtColorSel.RelativeLight", false));
    
    recalculateRings(
                cfg.readEntry("ArtColorSel.NumRings"  , 11),
                cfg.readEntry("ArtColorSel.RingPieces", 12)
                );
    
    QList<float> angles = cfg.readList<float>("ArtColorSel.RingAngles");

    for (int i = 0; i < m_colorRings.size(); ++i) {
        if (i < angles.size() && i < m_colorRings.size()) {
            m_colorRings[i].angle = angles[i];
        }
    }
    
    selectColor(m_selectedColor);
    update();
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:31,代码来源:kis_color_selector.cpp


示例3: init

void init(void)
{
 //背景色
  glClearColor(0.2, 0.2, 0.3, 1.0);

  setCamera();//視点を求める
  setLight(); //光源設定 
	glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  printf("マウス/キー操作の説明には'h'キーをプッシュ \n");

  glGenTextures(2, texName);//テクスチャオブジェクトの名前付け
  //Terrainデータの作成
	makeTerrainData();
  Bitmap* bm0 = new Bitmap();
  loadBitmap(bm0, "../../bmp/altgrad4.bmp");
  makeTerrainImage(bm0);
  setTerrainTexture(0);

	//particle用テクスチャ
  Bitmap* bm1 = new Bitmap();
  loadBitmap(bm1, "../../bmp/snow1.bmp");
  makeParticleImage(bm1);
  setParticleTexture(1);
	//時間計測
  lastTime = timeGetTime();
  elapseTime1 = 0.0;
  elapseTime2 = 0.0;
	countP = 0.0;

}
开发者ID:kzfm1024,项目名称:misc,代码行数:31,代码来源:slSnow2.cpp


示例4: mapCoord

void KisColorSelector::mousePressEvent(QMouseEvent* event)
{
    m_clickPos       = mapCoord(event->posF(), m_renderArea);
    m_mouseMoved     = false;
    m_pressedButtons = event->buttons();
    m_clickedRing    = getSaturationIndex(m_clickPos);
    
    qint8 clickedLightPiece = getLightIndex(event->posF());
    
    if (clickedLightPiece >= 0) {
        setLight(getLight(event->posF()), m_relativeLight);
        m_selectedLightPiece = clickedLightPiece;
        setSelectedColor(m_selectedColor, !(m_pressedButtons & Qt::RightButton), true);
        m_mouseMoved   = true;
    }
    else if (m_clickedRing >= 0) {
        if (getNumPieces() > 1) {
            for(int i=0; i<getNumRings(); ++i)
                m_colorRings[i].setTemporaries(m_selectedColor);
        }
        else {
            Radian angle = std::atan2(m_clickPos.x(), m_clickPos.y()) - RAD_90;
            m_selectedColor.setH(angle.scaled(0.0f, 1.0f));
            m_selectedColor.setS(getSaturation(m_clickedRing));
            m_selectedColor.setX(getLight(m_light, m_selectedColor.getH(), m_relativeLight));
            setSelectedColor(m_selectedColor, !(m_pressedButtons & Qt::RightButton), true);
            m_selectedRing = m_clickedRing;
            m_mouseMoved   = true;
            update();
        }
    }
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:32,代码来源:kis_color_selector.cpp


示例5: switch

void SceneView::inheritCullSettings(const osg::CullSettings& settings, unsigned int inheritanceMask)
{
    if (_camera.valid() && _camera->getView()) 
    {
        if (inheritanceMask & osg::CullSettings::LIGHTING_MODE)
        {
            LightingMode newLightingMode = _lightingMode;
        
            switch(_camera->getView()->getLightingMode())
            {
                case(osg::View::NO_LIGHT): newLightingMode = NO_SCENEVIEW_LIGHT; break;
                case(osg::View::HEADLIGHT): newLightingMode = HEADLIGHT; break;
                case(osg::View::SKY_LIGHT): newLightingMode = SKY_LIGHT; break;
            }
            
            if (newLightingMode != _lightingMode)
            {
                setLightingMode(newLightingMode);
            }
        }
                
        if (inheritanceMask & osg::CullSettings::LIGHT)
        {
            setLight(_camera->getView()->getLight());
        }
    }
    
    osg::CullSettings::inheritCullSettings(settings, inheritanceMask);
}
开发者ID:MichaelVlad,项目名称:Equalizer,代码行数:29,代码来源:sceneView.cpp


示例6: init

void init(void)
{
 //背景色
  glClearColor(0.2, 0.2, 0.3, 1.0);

  setCamera();//視点を求める
  setLight(); //光源設定 
	glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  printf("マウス/キー操作の説明には'h'キーをプッシュ \n");

  //テクスチャの設定
  setCubeMap();
  //pet robot アニメーション
  pet.unitTime = 0.05;//1フレーム当たりの時間(最初は仮の値)
  //フレームデータを作成
  pet.numFrame0 = 0;
	pet.vPos.x =  1.0;
	pet.vPos.z = -1.0;
	pet.vAng.y = -90.0;
  pet.numFrame0 = 0;
  frameCount = 0;

	pet.walk(2.0, 0.2, 1.0);
	pet.turn(180.0, 2.0);
	pet.walk(2.0, 0.2, 1.0);
	pet.turn(-180.0, 2.0);
	pet.walk(2.0, 0.2, 1.0);
	pet.turn(180, 2.0);
	pet.walk(2.0, 0.2, 1.0);
	pet.turn(-180.0, 2.0);
	printf("numFrame0=%d \n", pet.numFrame0);
}
开发者ID:kzfm1024,项目名称:misc,代码行数:33,代码来源:slCubeRefract1.cpp


示例7: while

void Intervalometer::init()
{
	Serial.begin(9600);
    while(!Serial){}
	
	pinMode       (shuterPin,OUTPUT);
	pinMode       (displayPin,OUTPUT);
	pinMode		  (brightnessPin, OUTPUT);
	digitalWrite  (shuterPin,LOW);
	digitalWrite  (displayPin,HIGH);
  
  
	p_lcd-> 					init();
	p_buttonLightUp->  			init();
	p_buttonLightDown->			init();
	p_buttonUp->            	init();
	p_buttonDown->          	init();
	p_buttonOk->            	init();
	p_buttonBack->			 	init();
	p_led->				     	init();
	p_lcd->     createChar(2, kamera);
	p_lcd -> 	createChar(1,PfeilDown);
	p_lcd -> 	createChar(0,PfeilUp);
	
	setLight();
	intro();
	p_lcd->clear();
	
	Serial.println("SETUP DONE");	
}
开发者ID:KROIA,项目名称:Arduino,代码行数:30,代码来源:Intervalometer.cpp


示例8: init

void init(void)
{
 //背景色
  glClearColor(0.2, 0.2, 0.3, 1.0);

  setCamera();//視点を求める
  setLight(); //光源設定 
	glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  printf("マウス/キー操作の説明には'h'キーをプッシュ \n");

  //Terrainデータの作成
	makeTerrainData();
  Bitmap* bm0 = new Bitmap();
  loadBitmap(bm0, "../../bmp/altgrad4.bmp");
  makeTerrainImage(bm0);
  setTerrainTexture();
	//particle
  countP = 0;
  fps = 0;
  elapseTime1 = 0.0;//1sec間以内の経過時間
  elapseTime2 = 0.0; //init()後の総経過時間
  for(int i = 0; i < NUM_PARTICLE; i++) p[i] = CParticle();
  for(int i = 0; i < NUM_PARTICLE2; i++) q[i] = CParticle2();
	frameCount = 0;
}
开发者ID:kzfm1024,项目名称:misc,代码行数:26,代码来源:slWaterfall.cpp


示例9: Item

Spawn::Spawn(uint16_t id, 
	     int16_t x, int16_t y, int16_t z,
	     int16_t deltaX, int16_t deltaY, int16_t deltaZ,
	     int8_t heading, int8_t deltaHeading,
	     uint8_t animation) 
  : Item(tSpawn, id)
{
  // apply the unknown mob values
  m_name = "unknown";
  setNPC(SPAWN_NPC_UNKNOWN);

  // set what is known
  setPos(x, y, z);
  setDeltas(deltaX, deltaY, deltaZ);
  setHeading(heading, deltaHeading);
  setAnimation(animation);
  
  // initialize what isn't to 0
  setPetOwnerID(0);
  setLight(0);
  setGender(0);
  setDeity(0);
  setRace(0);
  setClassVal(0);
  setHP(0);
  setMaxHP(0);
  setLevel(0);
  for (int i = 0; i < tNumWearSlots; i++)
    setEquipment(i, 0);
  setTypeflag(0);
  setConsidered(false);

  // turn on auto delete for the track list
  m_spawnTrackList.setAutoDelete(true);
}
开发者ID:xbackupx,项目名称:showeqx,代码行数:35,代码来源:spawn.cpp


示例10: pinMode

bool ClydeDev::init() {

	// -- pins
  pinMode(eye_r_pin, OUTPUT);
  pinMode(eye_g_pin, OUTPUT);
  pinMode(eye_b_pin, OUTPUT);
   
  pinMode(eye_ir_pin, INPUT);
   
  pinMode(white_pin, OUTPUT);
  setLight(0);


  


	if(LOG_LEVEL <= DEBUG) *debug_stream << "Beginning initialisation of Clyde" << endl; 


	current_colour[0] = 0;
	current_colour[1] = 0;
	current_colour[2] = 0;

	current_hue = 0;


  // -- eye / ir sample related
  last_calibrated = 0;
  last_sampled = 0;
  sample_count = 0;
  ir_total = 0;
  ir_range_avg = 0;
  done_calibration = false;


  // the raw, un-averaged, ir vals from analog in
  current_ir_raw = 0;
  previous_ir_raw = 0;
  ir_min_raw = 0;
  ir_max_raw = 0;


  // the averaged reading ir vals over time
  current_ir_val = 0;
  previous_ir_val = 0;


  // eye button press related
  press_thresh = 0;
  press_start = 0;
  is_pressed = false;
  press_sample_count = 0;
  last_press = 0;


	initEye();

  return true;

}
开发者ID:RobotGrrl,项目名称:ClydeDev,代码行数:60,代码来源:ClydeDev.cpp


示例11: startLevel

/* Start a new level */
void startLevel(int newlev) {
   int i,j,x;
   light *p = board;
   
   /* Set up variables */
   moves = 0;
   level = newlev;
   memset(board,0,boardsize);
   memset(solution,0,boardsize);

   /* Make random moves */
   for (x=level;x;x--) {
      i = random() % boardwidth;
      j = random() % boardheight;
      invertLightNoupdate(i,j);
      invertLightNoupdate(i-1,j);
      invertLightNoupdate(i+1,j);
      invertLightNoupdate(i,j-1);
      invertLightNoupdate(i,j+1);
      SOLUTION(i,j) ^= 1;
   }
      
   /* Set the gropnode states */
   for (j=0;j<boardheight;j++)
     for (i=0;i<boardwidth;i++)
      setLight(i,j,*(p++));
   pgWriteCmd(wCanvas,PGCANVAS_INCREMENTAL,0);
   
   /* Update the status message and run pgUpdate() */
   updateStatus();
}
开发者ID:UIKit0,项目名称:picogui,代码行数:32,代码来源:blackout.c


示例12: init

void init(){
	//codes for initialization
	drawgrid=1;
	drawaxes=1;
//	cameraHeight=144.0;
//	cameraAngle=1.0;
	angle=0;

	zRotation = 0.0;

	//clear the screen
	glClearColor(0,0,0,0);

	setLight();

	/************************
	/ set-up projection here
	************************/
	//load the PROJECTION matrix
	glMatrixMode(GL_PROJECTION);

	//initialize the matrix
	glLoadIdentity();

	//give PERSPECTIVE parameters
	gluPerspective(80,	1,	1,	10000.0);
	//field of view in the Y (vertically)
	//aspect ratio that determines the field of view in the X direction (horizontally)
	//near distance
	//far distance
}
开发者ID:devmhd,项目名称:space-needle-opengl,代码行数:31,代码来源:main.cpp


示例13: glClearColor

void GameManager::setOpenGLStates() {
	//Set clear color
	glClearColor(0.0f,0.0f,0.0f,0.0f);

	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);

	//Enable culling
	glEnable(GL_CULL_FACE);
	//glEnable(GL_NORMALIZE);
	glShadeModel(GL_SMOOTH);

	//AA
	glEnable(GL_POINT_SMOOTH);
	glEnable(GL_LINE_SMOOTH);
	glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);

	// Enable texturing
	glEnable(GL_TEXTURE_2D);
	
	//Fog
	glEnable(GL_FOG);
	glFogi(GL_FOG_MODE, GL_EXP2);
	glFogf(GL_FOG_DENSITY, 0.01f);
	glHint(GL_FOG_HINT, GL_NICEST);

	//Apply light
	setLight();

	ResizeWindow(window_width, window_height);
}
开发者ID:pedert,项目名称:PG430,代码行数:31,代码来源:GameManager.cpp


示例14: digitalWrite

void Intervalometer::displayOn()
{
	displayStat = true;
	digitalWrite(displayPin, HIGH);
	p_lcd->init();
	setLight();
}
开发者ID:KROIA,项目名称:Arduino,代码行数:7,代码来源:Intervalometer.cpp


示例15: setLight

/******************************************************************************
 * Mouse move event handler
 *
 * @param e the event
 ******************************************************************************/
void SampleViewer::mouseMoveEvent( QMouseEvent* e )
{
	//if (_light1->grabsMouse())
	if ( _moveLight )
	{
		int mx = e->x();
		int my = e->y();

		_light[ 4 ] += ( _light[ 5 ] - e->x() ) / 100.0f;
		_light[ 5 ] = e->x();
		_light[ 3 ] += -( _light[ 6 ] - e->y() ) / 100.0f;
		_light[ 6 ] = e->y();

		if ( _light[ 3 ] < 0.0f )
		{
			_light[ 3 ] = 0.0f;
		}

		if ( _light[ 3 ] > (float)M_PI )
		{
			_light[3] = (float)M_PI;
		}

		setLight( _light[ 3 ], _light[ 4 ] );
	}
	else
	{
		QGLViewer::mouseMoveEvent( e );
	}
}
开发者ID:webanck,项目名称:GigaVoxels,代码行数:35,代码来源:SampleViewer.cpp


示例16: processLightCommand

char processLightCommand(char commandCode, void* commandData, void* responseDate) {
   switch(commandCode) {
      case SET_LIGHT:
	 setLight(*((char*)commandData));
         break;
   }
}
开发者ID:jleija42,项目名称:CPRC-IGVC,代码行数:7,代码来源:protocol.c


示例17: displayNavigateSubwindow

void displayNavigateSubwindow()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	glLoadIdentity();

	setNavigateSubwindowCamera(&estado.camera, modelo.objecto);
    setLight();

	glCallList(modelo.labirinto[JANELA_NAVIGATE]);
	glCallList(modelo.chao[JANELA_NAVIGATE]);

	if(!estado.vista[JANELA_NAVIGATE])
      {
        glPushMatrix();
            glTranslatef(modelo.objecto.pos.x,modelo.objecto.pos.y,modelo.objecto.pos.z);
            glRotatef(GRAUS(modelo.objecto.dir),0,1,0);
            glRotatef(-90,1,0,0);
            glScalef(SCALE_HOMER,SCALE_HOMER,SCALE_HOMER);
            mdlviewer_display(modelo.homer[JANELA_NAVIGATE]);
        glPopMatrix();
      }

	desenhaBussola(glutGet(GLUT_WINDOW_WIDTH),glutGet(GLUT_WINDOW_HEIGHT));

	glutSwapBuffers();
}
开发者ID:1100580,项目名称:Cplusplus-graphic-systems,代码行数:27,代码来源:main.cpp


示例18: switch

void LightingHandler::setMode(uint8_t which, uint8_t value) {
  lightModes[which] = value;
  switch(value) {
  case 0:
    setLight(which,(lightValues[which]--)+1);
    break;
  }
}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:8,代码来源:LightingHandler.cpp


示例19: cmd_light

void cmd_light( BaseChannel *chp, int argc, char * argv [] )
{
	(void)chp;
    if ( argc > 0 )
    {
        if ( argv[0][0] != '0' )
        {
            setLight( 1 );
            chprintf( chp, "ok:ledon" );
        }
        else
        {
            setLight( 0 );
            chprintf( chp, "ok:ledoff" );
        }
    }
}
开发者ID:z80,项目名称:robocam,代码行数:17,代码来源:light_ctrl.c


示例20: processLightCommand

char processLightCommand(char commandCode, void* commandData, Response* responseData) {
	responseData->size = 0;
   switch(commandCode) {
   case SET_LIGHT:
	 	setLight(*((char*)commandData));
      break;
   }
   return 1;
}
开发者ID:CalPolyRobotics,项目名称:IGVC,代码行数:9,代码来源:protocol.c



注:本文中的setLight函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setLineWidth函数代码示例发布时间:2022-05-30
下一篇:
C++ setLevel函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap