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

C++ short函数代码示例

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

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



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

示例1: PIL_check_seconds_timer

// image calculation
// load frame from video
void VideoFFmpeg::calcImage (unsigned int texId, double ts)
{
	if (m_status == SourcePlaying)
	{
		// get actual time
		double startTime = PIL_check_seconds_timer();
		double actTime;
		// timestamp passed from audio actuators can sometimes be slightly negative
		if (m_isFile && ts >= -0.5)
		{
			// allow setting timestamp only when not streaming
			actTime = ts;
			if (actTime * actFrameRate() < m_lastFrame) 
			{
				// user is asking to rewind, force a cache clear to make sure we will do a seek
				// note that this does not decrement m_repeat if ts didn't reach m_range[1]
				stopCache();
			}
		}
		else
		{
			if (m_lastFrame == -1 && !m_isFile)
				m_startTime = startTime;
			actTime = startTime - m_startTime;
		}
		// if video has ended
		if (m_isFile && actTime * m_frameRate >= m_range[1])
		{
			// in any case, this resets the cache
			stopCache();
			// if repeats are set, decrease them
			if (m_repeat > 0) 
				--m_repeat;
			// if video has to be replayed
			if (m_repeat != 0)
			{
				// reset its position
				actTime -= (m_range[1] - m_range[0]) / m_frameRate;
				m_startTime += (m_range[1] - m_range[0]) / m_frameRate;
			}
			// if video has to be stopped, stop it
			else 
			{
				m_status = SourceStopped;
				return;
			}
		}
		// actual frame
		long actFrame = (m_isImage) ? m_lastFrame+1 : long(actTime * actFrameRate());
		// if actual frame differs from last frame
		if (actFrame != m_lastFrame)
		{
			AVFrame* frame;
			// get image
			if ((frame = grabFrame(actFrame)) != NULL)
			{
				if (!m_isFile && !m_cacheStarted) 
				{
					// streaming without cache: detect synchronization problem
					double execTime = PIL_check_seconds_timer() - startTime;
					if (execTime > 0.005) 
					{
						// exec time is too long, it means that the function was blocking
						// resynchronize the stream from this time
						m_startTime += execTime;
					}
				}
				// save actual frame
				m_lastFrame = actFrame;
				// init image, if needed
				init(short(m_codecCtx->width), short(m_codecCtx->height));
				// process image
				process((BYTE*)(frame->data[0]));
				// finished with the frame, release it so that cache can reuse it
				releaseFrame(frame);
				// in case it is an image, automatically stop reading it
				if (m_isImage)
				{
					m_status = SourceStopped;
					// close the file as we don't need it anymore
					release();
				}
			} else if (m_isStreaming)
			{
				// we didn't get a frame and we are streaming, this may be due to
				// a delay in the network or because we are getting the frame too fast.
				// In the later case, shift time by a small amount to compensate for a drift
				m_startTime += 0.001;
			}
		}
	}
}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:94,代码来源:VideoFFmpeg.cpp


示例2: switch

LRESULT CALLBACK Win32Assistant::WindowProc (HWND hWnd, UINT message,
  WPARAM wParam, LPARAM lParam)
{
  Win32Assistant* assistant;
  if (IsWindowUnicode (hWnd))
    assistant = (Win32Assistant*)GetWindowLongPtrW (hWnd, 0);
  else
    assistant = (Win32Assistant*)GetWindowLongPtrA (hWnd, 0);
  switch (message)
  {
    case WM_ACTIVATEAPP:
      if ((assistant != 0))
      {
        if (wParam) 
	{ 
	  assistant->ApplicationActive = true; 
	} 
	else 
	{ 
	  assistant->ApplicationActive = false; 
	}
      }
      break;
    case WM_ACTIVATE:
      if ((assistant != 0))
      {
	iEventOutlet* outlet = assistant->GetEventOutlet();
        if (LOWORD(wParam) != WA_INACTIVE)
          outlet->Broadcast (assistant->FocusGained, 1);
        else
          outlet->Broadcast (assistant->FocusLost, 0);
      }
      break;
    case WM_CREATE:
      {
	CreateInfo* ci;
	if (IsWindowUnicode (hWnd))
	{
	  ci = (CreateInfo*)((LPCREATESTRUCTW)lParam)->lpCreateParams;
	  SetWindowLongPtrW (hWnd, 0, (LONG_PTR)ci->assistant);
	  SetWindowLongPtrW (hWnd, sizeof (LONG_PTR), (LONG_PTR)ci->canvas);
	}
	else
	{
	  ci = (CreateInfo*)((LPCREATESTRUCTA)lParam)->lpCreateParams;
	  SetWindowLongPtrA (hWnd, 0, (LONG_PTR)ci->assistant);
	  SetWindowLongPtrA (hWnd, sizeof (LONG_PTR), (LONG_PTR)ci->canvas);
	}
	// a window is created. Hide the console window, if requested.
	if (ci->assistant->is_console_app && 
	  !ci->assistant->console_window)
	{
	  ci->assistant->DisableConsole ();
	}
      }
      break;
    case WM_SYSCOMMAND:
      if (wParam == SC_CLOSE)
      {
	PostQuitMessage (0);
	return TRUE;
      }
      break;
    case WM_SYSCHAR:
    case WM_CHAR:
    case WM_UNICHAR:
    case WM_DEADCHAR:
    case WM_SYSDEADCHAR:
    case WM_IME_COMPOSITION:
    case WM_KEYDOWN:
    case WM_SYSKEYDOWN:
    case WM_KEYUP:
    case WM_SYSKEYUP:
    {
      if (assistant != 0)
      {	  
	if (assistant->HandleKeyMessage (hWnd, message, wParam, lParam))
	{
	  return 0;
	}
      }
      break;
    }
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN:
    case WM_MBUTTONDOWN:
    {
      if (assistant != 0)
      {
	const int buttonNum = (message == WM_LBUTTONDOWN) ? csmbLeft :
          (message == WM_RBUTTONDOWN) ? csmbRight : csmbMiddle;
        if (assistant->mouseButtons == 0) SetCapture (hWnd);
	assistant->mouseButtons |= 1 << (buttonNum - csmbLeft);

        iEventOutlet* outlet = assistant->GetEventOutlet();
        outlet->Mouse (buttonNum, true,
          short (LOWORD (lParam)), short (HIWORD (lParam)));
      }
      return TRUE;
    }
//.........这里部分代码省略.........
开发者ID:garinh,项目名称:cs,代码行数:101,代码来源:win32.cpp


示例3: err_when

//--------- Begin of function UnitArray::move_to_now ---------//
//
// Order the unit to move to a specific location following the
// shortest path.
//
// <int> 	destXLoc, destYLoc - the location of the destination.
// <short*> selectedUnitArray  - an array of recno of selected units.
// <int>    selectedCount 		 - no. of selected units.
//
void UnitArray::move_to_now(int destXLoc, int destYLoc, short* selectedUnitArray, int selectedCount)
{
    err_when(destXLoc<0 || destYLoc<0 || destXLoc>=MAX_WORLD_X_LOC || destYLoc>=MAX_WORLD_Y_LOC);
    err_when( selectedCount > 10000 );

    //------------ define vars -----------------------//
    int		unprocessCount;// = selectedCount;		// num. of unprocessed sprite
    int		k;													// for counting
    short		vecX, vecY;										// used to reset x, y
    short		oddCount, evenCount;
    int		j;
    Unit*		unitPtr = unit_array[selectedUnitArray[0]];
    DWORD		curGroupId = unitPtr->unit_group_id;
    int		mobileType = unitPtr->mobile_type;
    Location	*worldLocMatrix=world.loc_matrix, *locPtr;
    //int		sizeOneSelectedCount=0, sizeTwoSelectedCount=0;
    int		sizeOneSelectedCount = selectedCount;

    //---------- set Unit::unit_group_id and count the unit by size ----------//
    int i;
    for( i=0 ; i<selectedCount ; i++ )
    {
        unitPtr = operator[](selectedUnitArray[i]);
        err_when(unitPtr->cur_action==SPRITE_IDLE && (unitPtr->cur_x!=unitPtr->next_x || unitPtr->cur_y!=unitPtr->next_y));
        err_when(unitPtr->action_para); // action_para should be set to zero in move_to()

        if(unitPtr->cur_action==SPRITE_ATTACK)
            unitPtr->stop();

        err_when(unitPtr->cur_action==SPRITE_ATTACK && unitPtr->action_para==0);
        if(unitPtr->cur_action==SPRITE_IDLE)
            unitPtr->set_ready();

        /*switch(unitPtr->sprite_info->loc_width)
        {
        	case 1:	sizeOneSelectedCount++;
        				break;

        	case 2:	sizeTwoSelectedCount++;
        				break;

        	default:	err_here();
        				break;
        }*/
    }
    unprocessCount = sizeOneSelectedCount;

    //---- construct array to store size one selected unit ----//
    short* selectedSizeOneUnitArray;
    if(sizeOneSelectedCount)
    {
        selectedSizeOneUnitArray = (short*)mem_add(sizeof(short)*sizeOneSelectedCount);
        memset(selectedSizeOneUnitArray, 0, sizeof(short)*sizeOneSelectedCount);
        for(i=0, k=0; i<selectedCount && unprocessCount; i++)
        {
            unitPtr = operator[](selectedUnitArray[i]);
            if(unitPtr->sprite_info->loc_width==1)
            {
                selectedSizeOneUnitArray[k++] = selectedUnitArray[i];
                unprocessCount--;
            }
        }
    }
    unprocessCount = sizeOneSelectedCount;

    //----------- variables initialization ---------------//
    int destX, destY;
    if(mobileType==UNIT_LAND)
    {
        x = destX = destXLoc;
        y = destY = destYLoc;
        move_scale = 1;
    }
    else // UNIT_AIR, UNIT_SEA
    {
        x = destX = (destXLoc/2)*2;
        y = destY = (destYLoc/2)*2;
        move_scale = 2;
    }

    //if(sizeOneSelectedCount)
    //{
    //----- initialize parameters and construct data structure -----//
    oddCount =1;
    evenCount = 3;
    square_size = not_tested_loc = lower_right_case = upper_left_case = 0;

    distance = (int*)mem_add(sizeof(int)*sizeOneSelectedCount);		// used in the function construct_sorted_array and this function,
    memset(distance, 0, sizeof(int)*sizeOneSelectedCount);				// and allocate/free the memory in this function

    sorted_distance = (int*)mem_add(sizeof(int)*sizeOneSelectedCount);
//.........这里部分代码省略.........
开发者ID:brianV,项目名称:7kaa,代码行数:101,代码来源:OUNITAM.cpp


示例4: tmp

inline void Scene::PhongColor (float px, float py, float pz, 
			       float nx, float ny, float nz,
			       Material* m,
			       short& rr, short& gg, short& bb)
{
  const float Eps = 1e-5f;

  // check for NULL material pointer - take scenes default material
  if ( ! m ) m = &mat;
    
  // check for image texture mapping
  if (m->use_image_texture) {
    Matpack.Error("Scene::PhongColor: image textures not yet available");
    rr = gg = bb = 0; 
    return;
  }

  // check for normal texturing function  - apply to normal vector
  if (m->use_normal_texture) {
    Vector3D tmp(nx,ny,nz);
    (*m).normal_texture(tmp);
    nx = tmp.x; ny = tmp.y; nz = tmp.z;
  }

  // normalization of normal vector
  float sn = hypot(nx,ny,nz);
  if (sn) { nx /= sn; ny /= sn; nz /= sn; }

  // normalization of coordinate vector of surface point
  float sp = hypot(px,py,pz), pxn = 0, pyn = 0, pzn = 0;
  if (sp) { pxn = px/sp; pyn = py/sp; pzn = pz/sp; }
    
  float r = 0,
        g = 0,
        b = 0,
        spec = 0,
        amb = m->ambient,    // ambient light contribution
        spc = m->specular;   // specular light contribution

  // loop through list of lights
  for (Light *l = FirstLight(); l; NextLight(l) ) {
	
    // distance of light to point on surface: sl = |light-point|
    float sxp = l->x - px, 
          syp = l->y - py, 
          szp = l->z - pz,
          sl = hypot(sxp,syp,szp),
          cs = (sl == 0.0) ? 0.0 : (nx*sxp+ny*syp+nz*szp)/sl;
	
    // If cs is negative then we look at the back side, if it is positive
    // then the front side is visible. The side is determined by the orientation
    // of the vertices in the facet (counter clockwise = front side).

    if (cs < 0.0) cs = 0;

    // ambient light plus diffuse reflection according to Lambert's law
    float light = (1.0 - amb) * cs + amb;
	
    // add specular reflection according to Bui-Tuong Phong's model
    if (spc > Eps) {
      if (sl && sp && sn) { 
	float qx = sxp/sl - pxn,
	      qy = syp/sl - pyn,
	      qz = szp/sl - pzn,
	      sq = hypot(qx,qy,qz);
	if (sq != 0.0) { 
	  float csa2 = (qx*nx+qy*ny+qz*nz) / sq,
	        csa  = 2.0 * csa2*csa2 - 1.0;
	  spec = (csa > Eps) ? spc * pow(csa,m->exponent) : 0.0;
	} else
	  spec = 0.0;
      } else 
	spec = 0.0;
    }

    // intensity factor of light
    light *= l->intensity;

    // now multiply light with surface color 
    // evaluate a texturing function if neccessary
    if (m->use_color_texture) {
      Vector3D tmp = Qinv * Vector3D(px,py,pz); // backtrafo to user coord.
      (*m).color_texture(tmp);
      r += light * l->red   * tmp.x + spec;
      g += light * l->green * tmp.y + spec;
      b += light * l->blue  * tmp.z + spec;
    } else {
      r += light * l->red   * m->color.red   + spec;
      g += light * l->green * m->color.green + spec;
      b += light * l->blue  * m->color.blue  + spec;
    }
  }
    
  // Fog can be simulated by mixing the background color to the surface color.
  // With increasing distance of the camera from the surface point (p) an 
  // exponentially increasing contribution of the background color 
  // should be mixed to the surface color. 
  //
  // But this model is not flexible enough. A much better fog is a 
  // parametrization using the hyperbolic tangent as blending function. 
//.........这里部分代码省略.........
开发者ID:lucafuji,项目名称:Gene-Correlation,代码行数:101,代码来源:scnshade.cpp


示例5: float

static DerivedMesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, DerivedMesh *dm)
{
	Mesh *me = ob->data;

	const int num_verts = dm->getNumVerts(dm);
	const int num_edges = dm->getNumEdges(dm);
	const int num_loops = dm->getNumLoops(dm);
	const int num_polys = dm->getNumPolys(dm);
	MVert *mvert;
	MEdge *medge;
	MLoop *mloop;
	MPoly *mpoly;

	const bool use_invert_vgroup = ((enmd->flag & MOD_NORMALEDIT_INVERT_VGROUP) != 0);
	const bool use_current_clnors = !((enmd->mix_mode == MOD_NORMALEDIT_MIX_COPY) &&
	                                  (enmd->mix_factor == 1.0f) &&
	                                  (enmd->defgrp_name[0] == '\0') &&
	                                  (enmd->mix_limit == (float)M_PI));

	int defgrp_index;
	MDeformVert *dvert;

	float (*loopnors)[3] = NULL;
	short (*clnors)[2];

	float (*polynors)[3];
	bool free_polynors = false;

	/* Do not run that modifier at all if autosmooth is disabled! */
	if (!is_valid_target(enmd) || !num_loops) {
		return dm;
	}

	if (!(me->flag & ME_AUTOSMOOTH)) {
		modifier_setError((ModifierData *)enmd, "Enable 'Auto Smooth' option in mesh settings");
		return dm;
	}

	medge = dm->getEdgeArray(dm);
	if (me->medge == medge) {
		/* We need to duplicate data here, otherwise setting custom normals (which may also affect sharp edges) could
		 * modify org mesh, see T43671. */
		dm = CDDM_copy(dm);
		medge = dm->getEdgeArray(dm);
	}
	mvert = dm->getVertArray(dm);
	mloop = dm->getLoopArray(dm);
	mpoly = dm->getPolyArray(dm);

	if (use_current_clnors) {
		dm->calcLoopNormals(dm, true, me->smoothresh);
		loopnors = dm->getLoopDataArray(dm, CD_NORMAL);
	}

	clnors = CustomData_duplicate_referenced_layer(&dm->loopData, CD_CUSTOMLOOPNORMAL, num_loops);
	if (!clnors) {
		DM_add_loop_layer(dm, CD_CUSTOMLOOPNORMAL, CD_CALLOC, NULL);
		clnors = dm->getLoopDataArray(dm, CD_CUSTOMLOOPNORMAL);
	}

	polynors = dm->getPolyDataArray(dm, CD_NORMAL);
	if (!polynors) {
		polynors = MEM_malloc_arrayN((size_t)num_polys, sizeof(*polynors), __func__);
		BKE_mesh_calc_normals_poly(mvert, NULL, num_verts, mloop, mpoly, num_loops, num_polys, polynors, false);
		free_polynors = true;
	}

	modifier_get_vgroup(ob, dm, enmd->defgrp_name, &dvert, &defgrp_index);

	if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
		normalEditModifier_do_radial(
		            enmd, ob, dm, clnors, loopnors, polynors,
		            enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
		            mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys);
	}
	else if (enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) {
		normalEditModifier_do_directional(
		            enmd, ob, dm, clnors, loopnors, polynors,
		            enmd->mix_mode, enmd->mix_factor, enmd->mix_limit, dvert, defgrp_index, use_invert_vgroup,
		            mvert, num_verts, medge, num_edges, mloop, num_loops, mpoly, num_polys);
	}

	if (free_polynors) {
		MEM_freeN(polynors);
	}

	return dm;
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:88,代码来源:MOD_normal_edit.c


示例6: frameThreads

std::vector<bool> Halite::processNextFrame(std::vector<bool> alive) {

	//Update alive frame counts
	for(unsigned char a = 0; a < number_of_players; a++) if(alive[a]) alive_frame_count[a]++;

	//Create threads to send/receive data to/from players. The threads should return a float of how much time passed between the end of their message being sent and the end of the AI's message being sent.
	std::vector< std::future<unsigned int> > frameThreads(std::count(alive.begin(), alive.end(), true));
	unsigned char threadLocation = 0; //Represents place in frameThreads.

	//Figure out how long each AI is permitted to respond without penalty in milliseconds.
	std::vector<int> allowableTimesToRespond(number_of_players);
	const int BOT_FRAME_TIMEOUT_MILLIS = 50 + ((game_map.map_width * game_map.map_height) / 2);
	for(unsigned char a = 0; a < number_of_players; a++) allowableTimesToRespond[a] = BOT_FRAME_TIMEOUT_MILLIS;

	//Stores the messages sent by bots this frame
	for(unsigned char a = 0; a < number_of_players; a++) {
		if(alive[a]) {
			frameThreads[threadLocation] = std::async(&Networking::handleFrameNetworking, &networking, allowableTimesToRespond[a], a + 1, game_map, &player_moves[a]);
			threadLocation++;
		}
	}

	std::vector< std::vector<unsigned char> > moveDirections(game_map.map_height, std::vector<unsigned char>(game_map.map_width, 0));

	//Join threads. Figure out if the player responded in an allowable amount of time or if the player has timed out.
	std::vector<unsigned short> permissibleTime(number_of_players, false);
	threadLocation = 0; //Represents place in frameThreads.
	for(unsigned char a = 0; a < number_of_players; a++) {
		if(alive[a]) {
			unsigned short millis = frameThreads[threadLocation].get();
			if(millis < BOT_FRAME_TIMEOUT_MILLIS) {
				permissibleTime[a] = true;
			}
			//	There was an exception in the networking thread or the player timed out. Either way, kill their thread
			else {
				if(!program_output_style) std::cout << player_names[a] << " timed out\n";
				permissibleTime[a] = false;
				networking.killPlayer(a + 1);
			}
			threadLocation++;
			total_response_time[a] += millis;
		}
	}

	std::vector< std::map<hlt::Location, unsigned char> > pieces(number_of_players);

	//For each player, use their moves to create the pieces map.
	for(unsigned char a = 0; a < number_of_players; a++) if(alive[a]) {
		//Add in pieces according to their moves. Also add in a second piece corresponding to the piece left behind.
		for(auto b = player_moves[a].begin(); b != player_moves[a].end(); b++) if(game_map.inBounds(b->loc) && game_map.getSite(b->loc, STILL).owner == a + 1) {
			if(b->dir == STILL) {
				if(game_map.getSite(b->loc, STILL).strength + game_map.getSite(b->loc, STILL).production <= 255) game_map.getSite(b->loc, STILL).strength += game_map.getSite(b->loc, STILL).production;
				else game_map.getSite(b->loc, STILL).strength = 255;
				//Update full still count
				full_still_count[a]++;
				//Add to full production
				full_production_count[a] += game_map.getSite(b->loc, STILL).production;
			}
			//Update full caridnal count.
			else full_cardinal_count[a]++;

			//Update moves
			moveDirections[b->loc.y][b->loc.x] = b->dir;

			hlt::Location newLoc = game_map.getLocation(b->loc, b->dir);
			if(pieces[a].count(newLoc)) {
				if(short(pieces[a][newLoc]) + game_map.getSite(b->loc, STILL).strength <= 255) pieces[a][newLoc] += game_map.getSite(b->loc, STILL).strength;
				else pieces[a][newLoc] = 255;
			}
			else {
				pieces[a].insert(std::pair<hlt::Location, unsigned char>(newLoc, game_map.getSite(b->loc, STILL).strength));
			}

			//Add in a new piece with a strength of 0 if necessary.
			if(!pieces[a].count(b->loc)) {
				pieces[a].insert(std::pair<hlt::Location, unsigned char>(b->loc, 0));
			}

			//Erase from the game map so that the player can't make another move with the same piece.
			game_map.getSite(b->loc, STILL).owner = 0;
			game_map.getSite(b->loc, STILL).strength = 0;
		}
	}

	//Add in all of the remaining pieces whose moves weren't specified.
	for(unsigned short a = 0; a < game_map.map_height; a++) for(unsigned short b = 0; b < game_map.map_width; b++) {
		hlt::Location l = { b, a };
		hlt::Site & s = game_map.getSite(l, STILL);
		if(s.owner != 0) {
			if(short(s.strength) + s.production <= 255) {
				s.strength += s.production;
			}
			else s.strength = 255;
			if(pieces[s.owner - 1].count(l)) {
				if(short(pieces[s.owner - 1][l]) + s.strength <= 255) pieces[s.owner - 1][l] += s.strength;
				else pieces[s.owner - 1][l] = 255;
			}
			else {
				pieces[s.owner - 1].insert(std::pair<hlt::Location, unsigned char>(l, s.strength));
			}
//.........这里部分代码省略.........
开发者ID:chmullig,项目名称:Halite,代码行数:101,代码来源:Halite.cpp


示例7: ASSERT

PintObjectHandle Bullet::CreateObject(const PINT_OBJECT_CREATE& desc)
{
	udword NbShapes = desc.GetNbShapes();
	if(!NbShapes)
		return null;

	ASSERT(mDynamicsWorld);

	const PINT_SHAPE_CREATE* CurrentShape = desc.mShapes;

	float FrictionCoeff = 0.5f;
	float RestitutionCoeff = 0.0f;
	btCollisionShape* colShape = null;
	if(NbShapes>1)
	{
		btCompoundShape* CompoundShape = new btCompoundShape();
		colShape = CompoundShape;
		mCollisionShapes.push_back(colShape);

		while(CurrentShape)
		{
			if(CurrentShape->mMaterial)
			{
				FrictionCoeff		= CurrentShape->mMaterial->mDynamicFriction;
				RestitutionCoeff	= CurrentShape->mMaterial->mRestitution;
			}

			const btTransform LocalPose(ToBtQuaternion(CurrentShape->mLocalRot), ToBtVector3(CurrentShape->mLocalPos));

			// ### TODO: where is this deleted?
			btCollisionShape* subShape = CreateBulletShape(*CurrentShape);
			if(subShape)
			{
				CompoundShape->addChildShape(LocalPose, subShape);
			}

			CurrentShape = CurrentShape->mNext;
		}
	}
	else
	{
		colShape = CreateBulletShape(*CurrentShape);

		if(CurrentShape->mMaterial)
		{
			FrictionCoeff		= CurrentShape->mMaterial->mDynamicFriction;
			RestitutionCoeff	= CurrentShape->mMaterial->mRestitution;
		}
	}

	const bool isDynamic = (desc.mMass != 0.0f);

	btVector3 localInertia(0,0,0);
	if(isDynamic)
		colShape->calculateLocalInertia(desc.mMass, localInertia);

	const btTransform startTransform(ToBtQuaternion(desc.mRotation), ToBtVector3(desc.mPosition));

	//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
	btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);

	btRigidBody::btRigidBodyConstructionInfo rbInfo(desc.mMass, myMotionState, colShape, localInertia);
	{
		rbInfo.m_friction		= FrictionCoeff;
		rbInfo.m_restitution	= RestitutionCoeff;

	//	rbInfo.m_startWorldTransform;
		rbInfo.m_linearDamping				= gLinearDamping;
		rbInfo.m_angularDamping				= gAngularDamping;
		if(!gEnableSleeping)
		{
//			rbInfo.m_linearSleepingThreshold	= 99999999.0f;
//			rbInfo.m_angularSleepingThreshold	= 99999999.0f;
//			rbInfo.m_linearSleepingThreshold	= 0.0f;
//			rbInfo.m_angularSleepingThreshold	= 0.0f;
		}
	//	rbInfo.m_additionalDamping;
	//	rbInfo.m_additionalDampingFactor;
	//	rbInfo.m_additionalLinearDampingThresholdSqr;
	//	rbInfo.m_additionalAngularDampingThresholdSqr;
	//	rbInfo.m_additionalAngularDampingFactor;
	}
	btRigidBody* body = new btRigidBody(rbInfo);
	ASSERT(body);
	if(!gEnableSleeping)
		body->setActivationState(DISABLE_DEACTIVATION);

	sword collisionFilterGroup, collisionFilterMask;

	if(isDynamic)
	{
		body->setLinearVelocity(ToBtVector3(desc.mLinearVelocity));
		body->setAngularVelocity(ToBtVector3(desc.mAngularVelocity));

		collisionFilterGroup = short(btBroadphaseProxy::DefaultFilter);
		collisionFilterMask = short(btBroadphaseProxy::AllFilter);

		if(desc.mCollisionGroup)
		{
			const udword btGroup = RemapCollisionGroup(desc.mCollisionGroup);
//.........这里部分代码省略.........
开发者ID:DevO2012,项目名称:PEEL,代码行数:101,代码来源:PINT_Bullet281.cpp


示例8: a_short

string a_short() {
    return short();
}
开发者ID:Shea690901,项目名称:lima,代码行数:3,代码来源:ichannelt.c


示例9: ASSERT

//---------------------------------------------------------------------------
void CXMMTCtrl::OnReceive(CCSocket *pSocket, int nErrorCode)
{
	if( nErrorCode == SOCKET_ERROR ) return;
	ASSERT(pSocket);
	BYTE    bf[8192];
	UINT    n;

	n = pSocket->Receive(bf, sizeof(bf));
	int nIndex = 0;
	for( ; (nIndex < USERMAX) && (pSocket != m_pConnection[nIndex]); nIndex++ );
	if( nIndex >= USERMAX ) return;
	if( n != SOCKET_ERROR ){
		LPBYTE p = bf;
		for( UINT i = 0; i < n; i++, p++ ){
			if( !m_CustomSession[nIndex].IsOpen() ){
				switch(*p){
					case NOTIFY_PTTON:
						FireOnPttEvent(nIndex, TRUE);
						break;
					case NOTIFY_PTTOFF:
						FireOnPttEvent(nIndex, FALSE);
						break;
					case NOTIFY_BUSYON:
						m_bBusy[nIndex] = TRUE;
						FireOnBusyEvent(nIndex, TRUE);
						break;
					case NOTIFY_BUSYOFF:
						m_bBusy[nIndex] = FALSE;
						FireOnBusyEvent(nIndex, FALSE);
						break;
					case CODE_CUSTOMSESSION:
						// サーバーとクライアント間で定義された特別なデータの伝送が
						// 開始されます。
						m_CustomSession[nIndex].OpenSession();
						break;
					default:
						FireOnCharRcvd(nIndex, *p);
						break;
				}
			}
			else if( m_CustomSession[nIndex].PutData(*p) ){
				// サーバーとクライアント間で定義された特別なデータの伝送が終了
				// しました。ここでそのデータの処理を行います。
				CUSTOMSESSION *pCom = m_CustomSession[nIndex].GetData();
				switch(pCom->m_command){
					case COM_NOTIFY:
						// MMTTYからのmmtNotifyがここに通知されます。
						if( m_bNotify[nIndex] & ntNOTIFY ){
							FireOnNotifyNMMT(nIndex, (LONG *)pCom->m_pData);
						}
						break;
					case COM_NOTIFYFFT:
						// MMTTYからのmmtNotifyFFTがここに通知されます。
						if( m_bNotify[nIndex] & ntNOTIFYFFT ){
							COMFFT *pFFT = (COMFFT *)pCom->m_pData;
							if( m_bFftConversion ){
								DoFftConversion(nIndex, pFFT);
							}
							else {
								FireOnNotifyFFT(nIndex, pFFT->m_wdata, pFFT->m_wsize, pFFT->m_wsampfreq);
							}
						}
						break;
					case COM_NOTIFYXY:
						// MMTTYからのmmtNotifyXYがここに通知されます。
						if( m_bNotify[nIndex] & ntNOTIFYXY ){
							FireOnNotifyXY(nIndex, (LONG *)pCom->m_pData);
						}
						break;
					case COM_MESSAGERESULT:
						// COM_MESSAGERESULTでMMTTYに送信したメッセージの返答が
						// ここに通知されます。
						{
							COMMSG *pc = (COMMSG *)pCom->m_pData;
							if( pc->m_wParam == MMTMSG_GETPROFILENAME ){
								LPCSTR pStr = LPCSTR(pCom->m_pData + sizeof(COMMSG));
								if( pCom->m_len <= sizeof(COMMSG) ) pStr = "";
								FireOnGetProfileName(nIndex, short(pc->m_lParam), pStr);
							}
							else {
								FireOnMessageResult(nIndex, pc->m_wParam, pc->m_lParam, pc->m_lResult);
							}
						}
						break;
				}
				m_CustomSession[nIndex].Delete();
			}
		}
	}
}
开发者ID:ja7ude,项目名称:XMMT,代码行数:91,代码来源:XMMTCtl.cpp


示例10: eye_dir

void h_Player::UpdateBuildPos( const p_WorldPhysMesh& phys_mesh )
{
	m_Vec3 eye_dir(
		-std::sin( view_angle_.z ) * std::cos( view_angle_.x ),
		+std::cos( view_angle_.z ) * std::cos( view_angle_.x ),
		+std::sin( view_angle_.x ) );

	m_Vec3 eye_pos= pos_;
	eye_pos.z+= eyes_level_;
	float square_dist= std::numeric_limits<float>::max();
	h_Direction block_dir= h_Direction::Unknown;

	m_Vec3 intersect_pos;
	m_Vec3 candidate_pos;
	m_Vec3 n;

	for( const p_UpperBlockFace& face : phys_mesh.upper_block_faces )
	{
		n= g_block_normals[ static_cast<size_t>(face.dir) ];

		// Triangulate polygon and check intersection with triangles.
		m_Vec3 triangle[3];
		triangle[0]= m_Vec3( face.vertices[0], face.z );
		for( unsigned int i= 0; i < face.vertex_count - 2; i++ )
		{
			triangle[1]= m_Vec3( face.vertices[ i + 1 ], face.z );
			triangle[2]= m_Vec3( face.vertices[ i + 2 ], face.z );
			if( pRayHasIniersectWithTriangle( triangle, n, eye_pos, eye_dir, &candidate_pos ) )
			{
				float candidate_square_dist= ( candidate_pos - eye_pos ).SquareLength();
				if( candidate_square_dist < square_dist )
				{
					square_dist= candidate_square_dist;
					intersect_pos= candidate_pos;
					block_dir= face.dir;
				}
			}
		}
	}

	for( const p_BlockSide& side : phys_mesh.block_sides )
	{
		n= g_block_normals[ static_cast<size_t>(side.dir) ];

		m_Vec3 triangles[6];
		triangles[0]= m_Vec3( side.edge[0], side.z0 );
		triangles[1]= m_Vec3( side.edge[1], side.z0 );
		triangles[2]= m_Vec3( side.edge[1], side.z1 );
		triangles[3]= m_Vec3( side.edge[0], side.z1 );
		triangles[4]= m_Vec3( side.edge[0], side.z0 );
		triangles[5]= m_Vec3( side.edge[1], side.z1 );
		for( unsigned int i= 0; i < 2; i++ )
		{
			if( pRayHasIniersectWithTriangle( triangles + i * 3, n, eye_pos, eye_dir, &candidate_pos ) )
			{
				float candidate_square_dist= ( candidate_pos - eye_pos ).SquareLength();
				if( candidate_square_dist < square_dist )
				{
					square_dist= candidate_square_dist;
					intersect_pos= candidate_pos;
					block_dir= side.dir;
				}
			}
		}
	}

	if( block_dir == h_Direction::Unknown ||
		square_dist > g_max_build_distance * g_max_build_distance )
	{
		build_direction_= h_Direction::Unknown;
		return;
	}

	// Fix accuracy. Move intersection point inside target block.
	intersect_pos-= g_block_normals[ static_cast<size_t>(block_dir) ] * 0.1f;

	pGetHexogonCoord( intersect_pos.xy(), &destroy_pos_[0], &destroy_pos_[1] );
	destroy_pos_[2]= short( intersect_pos.z );

	discret_build_pos_[0]= destroy_pos_[0];
	discret_build_pos_[1]= destroy_pos_[1];
	discret_build_pos_[2]= destroy_pos_[2];

	switch( block_dir )
	{
	case h_Direction::Up: discret_build_pos_[2]++; break;
	case h_Direction::Down: discret_build_pos_[2]--; break;

	case h_Direction::Forward: discret_build_pos_[1]++; break;
	case h_Direction::Back: discret_build_pos_[1]--; break;

	case h_Direction::ForwardRight:
		discret_build_pos_[1]+= ( (discret_build_pos_[0]^1) & 1 );
		discret_build_pos_[0]++;
		break;
	case h_Direction::BackRight:
		discret_build_pos_[1]-= discret_build_pos_[0] & 1;
		discret_build_pos_[0]++;
		break;

//.........这里部分代码省略.........
开发者ID:Panzerschrek,项目名称:Hex,代码行数:101,代码来源:player.cpp


示例11: if


//.........这里部分代码省略.........
		// Find depth range and remap normalized depth range (-1 to 1) into 0...255
		// for color.
		float *dPtr = depthPixels;
		unsigned int i = 0;

		float zmin = 100.0f; // *dPtr;
		float zmax = -100.0f; // *dPtr;
		for(i=0; i<numPixels; i++)
		{
			float val = *dPtr; // * 2.0f - 1.0f;
			if(val < zmin) {
				zmin = *dPtr;
			}
			if(val > zmax) {
				zmax = *dPtr;
			}
			dPtr++;
		}
		float zrange = zmax - zmin;
		//printf("depth values = (%g, %g). Range = %g\n", zmin, zmax, zrange);

		unsigned char *cPtr = colorPixels;

		dPtr = depthPixels;
		for(i=0; i < numPixels; i++)
		{
			float val = *dPtr; // * 2.0f - 1.0f;
			//unsigned char depth = (unsigned char)(255.0f * (( (*dPtr)-zmin) / zrange) + zmin );
			unsigned char depth = (unsigned char)(255.0f * (( (val)-zmin) / zrange) );
			//unsigned char depth = (unsigned char)(255.0f * val);
			*cPtr = depth; cPtr++;
			*cPtr = depth; cPtr++;
			*cPtr = depth; cPtr++;
			*cPtr = 0xff;   
			cPtr++;
			dPtr++;
		}

		MImage image;
		image.setPixels( colorPixels, width, height );

		// Uncomment next line to test writing buffer to file.
		//image.writeToFile( "C:\\temp\\dumpDepth.iff" );

		// Write all pixels back. The origin of the image (lower left)
		// is used 
		status = view.writeColorBuffer( image, 5, 5 );

		if (depthPixels)
			delete depthPixels;
		if (colorPixels)
			delete colorPixels;
	}

	// Do a simple color invert operation on all pixels
	//
	else if (thisCompute->mBufferOperation == kInvertColorBuffer)
	{
		// Optional to read as RGBA. Note that this will be slower
		// since we must swizzle the bytes around from the default
		// BGRA format.
		bool readAsRGBA = true;

		// Read the RGB values from the color buffer
		MImage image;
		status = view.readColorBuffer( image, readAsRGBA );
		if (status != MS::kSuccess)
			return;

		status = view.writeColorBuffer( image, 5, 5 );

		unsigned char *pixelPtr = (unsigned char*)image.pixels();
		if (pixelPtr)
		{
			unsigned int width, height;
			image.getSize( width, height );

			MImage image2;
			image2.create( width, height );
			unsigned char *pixelPtr2 = (unsigned char*)image2.pixels();

			unsigned int numPixels = width * height;
			for (unsigned int i=0; i < numPixels; i++)
			{
				*pixelPtr2 = (255 - *pixelPtr);	
				pixelPtr2++; pixelPtr++;
				*pixelPtr2 = (255 - *pixelPtr);	
				pixelPtr2++; pixelPtr++;
				*pixelPtr2 = (255 - *pixelPtr);	
				pixelPtr2++; pixelPtr++;
				*pixelPtr2 = 255;	
				pixelPtr2++; pixelPtr++;
			}

			// Write all pixels back. The origin of the image (lower left)
			// is used 
			status = view.writeColorBuffer( image2, 5, short(5+height/2) );
		}
	}
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:101,代码来源:viewCallbackTest.cpp


示例12: PrepareSystemFunctionGeneric

// This function should prepare system functions so that it will be faster to call them
int PrepareSystemFunctionGeneric(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine *engine)
{
	asASSERT(internal->callConv == ICC_GENERIC_METHOD || internal->callConv == ICC_GENERIC_FUNC);

	// Calculate the size needed for the parameters
	internal->paramSize = func->GetSpaceNeededForArguments();

	// Prepare the clean up instructions for the function arguments
	internal->cleanArgs.SetLength(0);
	int offset = 0;
	for( asUINT n = 0; n < func->parameterTypes.GetLength(); n++ )
	{
		asCDataType &dt = func->parameterTypes[n];

		if( (dt.IsObject() || dt.IsFuncdef()) && !dt.IsReference() )
		{
			if (dt.IsFuncdef())
			{
				asSSystemFunctionInterface::SClean clean;
				clean.op = 0; // call release
				clean.ot = &engine->functionBehaviours;
				clean.off = short(offset);
				internal->cleanArgs.PushLast(clean);
			}
			else if( dt.GetTypeInfo()->flags & asOBJ_REF )
			{
				asSTypeBehaviour *beh = &dt.GetTypeInfo()->CastToObjectType()->beh;
				asASSERT( (dt.GetTypeInfo()->flags & asOBJ_NOCOUNT) || beh->release );
				if( beh->release )
				{
					asSSystemFunctionInterface::SClean clean;
					clean.op  = 0; // call release
					clean.ot  = dt.GetTypeInfo()->CastToObjectType();
					clean.off = short(offset);
					internal->cleanArgs.PushLast(clean);
				}
			}
			else
			{
				asSSystemFunctionInterface::SClean clean;
				clean.op  = 1; // call free
				clean.ot  = dt.GetTypeInfo()->CastToObjectType();
				clean.off = short(offset);

				// Call the destructor then free the memory
				asSTypeBehaviour *beh = &dt.GetTypeInfo()->CastToObjectType()->beh;
				if( beh->destruct )
					clean.op = 2; // call destruct, then free

				internal->cleanArgs.PushLast(clean);
			}
		}

		if( dt.IsObject() && !dt.IsObjectHandle() && !dt.IsReference() )
			offset += AS_PTR_SIZE;
		else
			offset += dt.GetSizeOnStackDWords();
	}

	return 0;
}
开发者ID:RomanHargrave,项目名称:angelscript,代码行数:62,代码来源:as_callfunc.cpp


示例13: AddData

bool AuxPlayerIndex::BuildPacket(unsigned char *buffer, long &index)
{
    if (!(Flags[0] & 0x02))
    {
        return false;
    }

    index = 0;

    AddData(buffer, u32(0), index);
    AddData(buffer, short(0), index);
    AddData(buffer, char(1), index);

    AddFlags(Flags, sizeof(Flags), buffer, index);

    if (Flags[0] & 0x10)	//ExtendedFlags[2] & 0x40
    {
        AddData(buffer, Data.Credits, index);
    }

    if (Flags[0] & 0x20)	//ExtendedFlags[2] & 0x80
    {
        AddData(buffer, Data.XPDebt, index);
    }

    if (Flags[0] & 0x40)	//ExtendedFlags[3] & 0x01
    {
        SecureInv.BuildPacket(buffer, index);
    }

    if (Flags[0] & 0x80)	//ExtendedFlags[3] & 0x02
    {
        VendorInv.BuildPacket(buffer, index);
    }

    if (Flags[1] & 0x01)	//ExtendedFlags[3] & 0x04
    {
        RewardInv.BuildPacket(buffer, index);
    }

    if (Flags[1] & 0x02)	//ExtendedFlags[3] & 0x08
    {
        OverflowInv.BuildPacket(buffer, index);
    }

    if (Flags[1] & 0x04)	//ExtendedFlags[3] & 0x10
    {
        RPGInfo.BuildPacket(buffer, index);
    }

    if (Flags[1] & 0x08)	//ExtendedFlags[3] & 0x20
    {
        AddString(buffer, Data.CommunityEventFlags, index);
    }

    if (Flags[1] & 0x10)	//ExtendedFlags[3] & 0x40
    {
        AddData(buffer,Data.MusicID,index);
    }

    if (Flags[1] & 0x20)	//ExtendedFlags[3] & 0x80
    {
        Missions.BuildPacket(buffer, index);
    }

    if (Flags[1] & 0x40)	//ExtendedFlags[4] & 0x01
    {
        Reputation.BuildPacket(buffer, index);
    }

    if (Flags[1] & 0x80)	//ExtendedFlags[4] & 0x02
    {
        AddData(buffer, Data.PIPAvatarID, index);
    }

    if (Flags[2] & 0x01)	//ExtendedFlags[4] & 0x04
    {
        AddString(buffer, Data.RegistrationStarbase, index);
    }

    if (Flags[2] & 0x02)	//ExtendedFlags[4] & 0x08
    {
        AddString(buffer, Data.RegistrationStarbaseSector, index);
    }

    if (Flags[2] & 0x04)	//ExtendedFlags[4] & 0x10
    {
        AddString(buffer, Data.SectorName, index);
    }

    if (Flags[2] & 0x08)	//ExtendedFlags[4] & 0x20
    {
        AddData(buffer, Data.SectorNum, index);
    }

    if (Flags[2] & 0x10)	//ExtendedFlags[4] & 0x40
    {
        AddData(buffer, Data.ClientSendUITriggers ,index);
    }

//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:101,代码来源:AuxPlayerIndex.cpp


示例14: WindowProc


//.........这里部分代码省略.........
			if(pHGE->pD3D && pHGE->bActive != bActivating) pHGE->_FocusChange(bActivating);
			return FALSE;
*/
		case WM_ACTIVATE:
			// tricky: we should catch WA_ACTIVE and WA_CLICKACTIVE,
			// but only if HIWORD(wParam) (fMinimized) == FALSE (0)
			bActivating = (LOWORD(wparam) != WA_INACTIVE) && (HIWORD(wparam) == 0);
			if(pHGE->pD3D && pHGE->bActive != bActivating) pHGE->_FocusChange(bActivating);
			return FALSE;


		case WM_SETCURSOR:
			if(pHGE->bActive && LOWORD(lparam)==HTCLIENT && pHGE->bHideMouse) SetCursor(NULL);
			else SetCursor(LoadCursor(NULL, IDC_ARROW));
			return FALSE;

		case WM_SYSKEYDOWN:
			if(wparam == VK_F4)
			{
				if(pHGE->procExitFunc && !pHGE->procExitFunc()) return FALSE;
				return DefWindowProc(hwnd, msg, wparam, lparam);
			}
			else if(wparam == VK_RETURN)
			{
				pHGE->System_SetState(HGE_WINDOWED, !pHGE->System_GetState(HGE_WINDOWED));
				return FALSE;
			}
			else
			{
				pHGE->_BuildEvent(INPUT_KEYDOWN, wparam, HIWORD(lparam) & 0xFF, (lparam & 0x40000000) ? HGEINP_REPEAT:0, -1, -1);
				return FALSE;
			}

		case WM_KEYDOWN:
			pHGE->_BuildEvent(INPUT_KEYDOWN, wparam, HIWORD(lparam) & 0xFF, (lparam & 0x40000000) ? HGEINP_REPEAT:0, -1, -1);
			return FALSE;
		case WM_SYSKEYUP:
			pHGE->_BuildEvent(INPUT_KEYUP, wparam, HIWORD(lparam) & 0xFF, 0, -1, -1);
			return FALSE;
		case WM_KEYUP:
			pHGE->_BuildEvent(INPUT_KEYUP, wparam, HIWORD(lparam) & 0xFF, 0, -1, -1);
			return FALSE;

		case WM_LBUTTONDOWN:
			SetFocus(hwnd);
			pHGE->_BuildEvent(INPUT_MBUTTONDOWN, HGEK_LBUTTON, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;
		case WM_MBUTTONDOWN:
			SetFocus(hwnd);
			pHGE->_BuildEvent(INPUT_MBUTTONDOWN, HGEK_MBUTTON, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;
		case WM_RBUTTONDOWN:
			SetFocus(hwnd);
			pHGE->_BuildEvent(INPUT_MBUTTONDOWN, HGEK_RBUTTON, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;

		case WM_LBUTTONDBLCLK:
			pHGE->_BuildEvent(INPUT_MBUTTONDOWN, HGEK_LBUTTON, 0, HGEINP_REPEAT, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;
		case WM_MBUTTONDBLCLK:
			pHGE->_BuildEvent(INPUT_MBUTTONDOWN, HGEK_MBUTTON, 0, HGEINP_REPEAT, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;
		case WM_RBUTTONDBLCLK:
			pHGE->_BuildEvent(INPUT_MBUTTONDOWN, HGEK_RBUTTON, 0, HGEINP_REPEAT, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;

		case WM_LBUTTONUP:
			pHGE->_BuildEvent(INPUT_MBUTTONUP, HGEK_LBUTTON, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;
		case WM_MBUTTONUP:
			pHGE->_BuildEvent(INPUT_MBUTTONUP, HGEK_MBUTTON, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;
		case WM_RBUTTONUP:
			pHGE->_BuildEvent(INPUT_MBUTTONUP, HGEK_RBUTTON, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;

		case WM_MOUSEMOVE:
			pHGE->_BuildEvent(INPUT_MOUSEMOVE, 0, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;
		case 0x020A: // WM_MOUSEWHEEL, GET_WHEEL_DELTA_WPARAM(wparam);
			pHGE->_BuildEvent(INPUT_MOUSEWHEEL, short(HIWORD(wparam))/120, 0, 0, LOWORDINT(lparam), HIWORDINT(lparam));
			return FALSE;

		case WM_SIZE:
			if(pHGE->pD3D && wparam==SIZE_RESTORED) pHGE->_Resize(LOWORD(lparam), HIWORD(lparam));
			//return FALSE;
			break;

		case WM_SYSCOMMAND:
			if(wparam==SC_CLOSE)
			{
				if(pHGE->procExitFunc && !pHGE->procExitFunc()) return FALSE;
				pHGE->bActive=false;
				return DefWindowProc(hwnd, msg, wparam, lparam);
			}
			break;
	}

	return DefWindowProc(hwnd, msg, wparam, lparam);
}
开发者ID:cscjx321,项目名称:hge_game,代码行数:101,代码来源:system.cpp


示例15: the_short

string the_short() {
    return short();
}
开发者ID:Shea690901,项目名称:lima,代码行数:3,代码来源:ichannelt.c


示例16: a2

 short a2(int i) {return short(i+1);}
开发者ID:llvm-mirror,项目名称:libcxx,代码行数:1,代码来源:const_mem_fun1_t.pass.cpp


示例17: __TBB_get_cpu_ctl_env

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ short2str函数代码示例发布时间:2022-05-30
下一篇:
C++ shoot函数代码示例发布时间: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