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

C++ I_GetTime函数代码示例

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

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



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

示例1: F_RunWipe

//
// F_RunWipe
//
//
// After setting up the screens you want to
// wipe, calling this will do a 'typical'
// wipe.
//
void F_RunWipe(tic_t duration, boolean drawMenu)
{
	tic_t wipestart, tics, nowtime, y;
	boolean done;

	wipestart = I_GetTime() - 1;
	y = wipestart + duration; // init a timeout
	do
	{
		do
		{
			nowtime = I_GetTime();
			tics = nowtime - wipestart;
			if (!tics) I_Sleep();
		} while (!tics);
		wipestart = nowtime;

#ifdef SHUFFLE
		done = F_ScreenWipe(0, 0, vid.width, vid.height, tics);
#else
		if (rendermode == render_soft)
			done = F_ScreenWipe(0, 0, vid.width, vid.height, tics);
		else
			done = true;
#endif
		I_OsPolling();
		I_UpdateNoBlit();

		if (drawMenu)
			M_Drawer(); // menu is drawn even on top of wipes

		if (rendermode == render_soft)
			I_FinishUpdate(); // page flip or blit buffer
	} while (!done && I_GetTime() < y);
}
开发者ID:Logan-A,项目名称:SRB2-Public,代码行数:43,代码来源:f_wipe.c


示例2: TryRunTics

void TryRunTics (void)
{
	int runtics;
	int entertime = I_GetTime();

	// Wait for tics to run
	while (1)
	{
#ifdef HAVE_NET
    NetUpdate();
#else
    D_BuildNewTiccmds();
#endif

    runtics = (server ? remotetic : maketic) - gametic;
	
    if (!runtics)
	{
		if (server)
			I_WaitForPacket(ms_to_next_tick);
		else
			I_uSleep(ms_to_next_tick*1000);

		if (I_GetTime() - entertime > 10)
		{
			remotesend--;
			
			if (server)
			{
				char buf[sizeof(packet_header_t) + 1];
				
				packet_set((packet_header_t *)buf, PKT_RETRANS, remotetic);
				buf[sizeof(buf) - 1] = consoleplayer;
				I_SendPacket((packet_header_t *)buf, sizeof buf);
			}
			
			M_Ticker();
			return;
		}
		} else break;
	}

	while (runtics--)
	{
#ifdef HAVE_NET
		if (server) CheckQueuedPackets();
#endif
		if (advancedemo) D_DoAdvanceDemo ();
	
		M_Ticker ();
		G_Ticker ();
	
		gametic++;
	
#ifdef HAVE_NET
		NetUpdate(); // Keep sending our tics to avoid stalling remote nodes
#endif
	}
}
开发者ID:Doom-Utils,项目名称:dsdoom,代码行数:59,代码来源:d_client.c


示例3: CL_DownloadTicker

// Checks if we need to ask the server for a re-request of the current download
// chunk
void CL_DownloadTicker()
{
	dtime_t diff = 0;

	if(gamestate != GS_DOWNLOAD || download.filename.empty())
    {
		return;
    }

    if (download.timeout)
    {
        // Calculate how many seconds have elapsed since the last server 
        // response
        diff = I_GetTime() - download.timeout;

        if (diff)
            diff /= I_ConvertTimeFromMs(1000);
    }
    else
    {
        download.timeout = I_GetTime();
        return;
    }

    if (diff >= 3)
    {
		DPrintf("No response from server for %d seconds, re-requesting\n", diff);
		
		MSG_WriteMarker(&net_buffer, clc_wantwad);
		MSG_WriteString(&net_buffer, download.filename.c_str());
		MSG_WriteString(&net_buffer, download.md5.c_str());
		MSG_WriteLong(&net_buffer, download.got_bytes);

		NET_SendPacket(net_buffer, serveraddr);

		download.timeout = 0;

		++download.retrycount;
    }

    if (download.retrycount >= 5)
    {
        Printf(PRINT_HIGH, "Server hasn't responded to download re-requests, aborting\n");

        download.retrycount = 0;
        download.timeout = 0;

		CL_QuitNetGame();

		gamestate = GS_STARTUP;
    }
}
开发者ID:davidsgalbraith,项目名称:odamex,代码行数:54,代码来源:cl_download.cpp


示例4: TryRunTics

void TryRunTics(void)
{
    // get real tics
    int entertic = I_GetTime();
    int counts;

    // get available tics
    NetUpdate();

    counts = maketic - gametic;

    if (!counts && !vid_capfps)
        return;

    if (counts < 1)
        counts = 1;

    // wait for new tics if needed
    while (maketic < gametic + counts)
    {
        NetUpdate();

        // Still no tics to run? Sleep until some are available.
        if (maketic < gametic + counts)
        {
            // If we're in a netgame, we might spin forever waiting for
            // new network data to be received. So don't stay in here
            // forever - give the menu a chance to work.
            if (I_GetTime() - entertic >= MAX_NETGAME_STALL_TICS)
                return;

            I_Sleep(1);
        }
    }

    // run the count tics
    while (counts--)
    {
        if (advancetitle)
            D_DoAdvanceTitle();

        G_Ticker();
        gametic++;
        gametime++;

        if (netcmds[0].buttons & BT_SPECIAL)
            netcmds[0].buttons = 0;

        NetUpdate();
    }
}
开发者ID:mdgunn,项目名称:doomretro,代码行数:51,代码来源:d_loop.c


示例5: TryRunTics

void TryRunTics (void)
{
  int runtics;
  int entertime = I_GetTime();

  // Wait for tics to run
  while (1) {
    NetUpdate();
    runtics = (server ? remotetic : maketic) - gametic;
    if (!runtics) {
      if (!movement_smooth) {
        if (server)
          I_WaitForPacket(ms_to_next_tick);
        else
          I_uSleep(ms_to_next_tick*1000);
      }
      if (I_GetTime() - entertime > 10) {
        if (server) {
          char buf[sizeof(packet_header_t)+1];
          remotesend--;
          packet_set((packet_header_t *)buf, PKT_RETRANS, remotetic);
          buf[sizeof(buf)-1] = consoleplayer;
          I_SendPacket((packet_header_t *)buf, sizeof buf);
        }
        M_Ticker(); return;
      }
      {
        WasRenderedInTryRunTics = TRUE;
        if (movement_smooth && gamestate==wipegamestate)
        {
          isExtraDDisplay = TRUE;
          D_Display();
          isExtraDDisplay = FALSE;
        }
      }
    } else break;
  }

  while (runtics--) {
    if (server) CheckQueuedPackets();
    if (advancedemo)
      D_DoAdvanceDemo ();
    M_Ticker ();
    I_GetTime_SaveMS();
    G_Ticker ();
    P_Checksum(gametic);
    gametic++;
    NetUpdate(); // Keep sending our tics to avoid stalling remote nodes
  }
}
开发者ID:RobLoach,项目名称:libretro-prboom,代码行数:50,代码来源:d_client.c


示例6: Net_WaitAllAckReceived

// wait for all ackreturns with timeout in seconds
void Net_WaitAllAckReceived(UINT32 timeout)
{
	tic_t tictac = I_GetTime();
	timeout = tictac + timeout*TICRATE;

	HGetPacket();
	while (timeout > I_GetTime() && !Net_AllAckReceived())
	{
		while (tictac == I_GetTime())
			I_Sleep();
		tictac = I_GetTime();
		HGetPacket();
		Net_AckTicker();
	}
}
开发者ID:Pupswoof117,项目名称:SRB2-Public,代码行数:16,代码来源:d_net.c


示例7: I_FinishUpdate

void I_FinishUpdate(void)
{
	static int		lasttic;
	int				tics;
	int				i;

	// draws little dots on the bottom of the screen, a simple fps meter
	if (devparm)
	{
		i = I_GetTime();
		tics = i - lasttic;
		lasttic = i;
		if (tics > 20)
			tics = 20;

		for (i = 0; i < tics * 2; i += 2)
			screens[0][(SCREENHEIGHT - 2) * SCREENWIDTH + i + 3] = 0xff;
		for (; i < 20 * 2; i += 2)
			screens[0][(SCREENHEIGHT - 2) * SCREENWIDTH + i + 3] = 0x0;
	}

	// blit frame
	memcpy(vga_getgraphmem(), screens[0], SCREENWIDTH * SCREENHEIGHT);

	// sleep a bit if there was no sound update
	if (!snd_updated)
	{
		I_WaitVBL(1);
	}
}
开发者ID:aagallag,项目名称:psDooM,代码行数:30,代码来源:i_video_vga.c


示例8: Net_GetNetStat

boolean Net_GetNetStat(void)
{
	const tic_t t = I_GetTime();
	static INT64 oldsendbyte = 0;
	if (statstarttic+STATLENGTH <= t)
	{
		const tic_t df = t-statstarttic;
		const INT64 newsendbyte = sendbytes - oldsendbyte;
		sendbps = (INT32)(newsendbyte*TICRATE)/df;
		getbps = (getbytes*TICRATE)/df;
		if (sendackpacket)
			lostpercent = 100.0f*(float)retransmit/(float)sendackpacket;
		else
			lostpercent = 0.0f;
		if (getackpacket)
			duppercent = 100.0f*(float)duppacket/(float)getackpacket;
		else
			duppercent = 0.0f;
		if (ticruned)
			gamelostpercent = 100.0f*(float)ticmiss/(float)ticruned;
		else
			gamelostpercent = 0.0f;

		ticmiss = ticruned = 0;
		oldsendbyte = sendbytes;
		getbytes = 0;
		sendackpacket = getackpacket = duppacket = retransmit = 0;
		statstarttic = t;

		return 1;
	}
	return 0;
}
开发者ID:HipsterLion,项目名称:SRB2,代码行数:33,代码来源:d_net.c


示例9: ST_DrawFPS

void ST_DrawFPS(int offset) {
    static int    frames;
    static int    lasttick=0;
    static int    fps;
    int           ticks;
    int           n;

    ticks = I_GetTime();
    if(!lasttick) {
        lasttick = ticks;
        frames = fps = 0;
    }

    frames++;

    if(ticks - lasttick >= TICRATE) {
        lasttick = ticks;
        fps = frames;
        frames = 0;
        if(fps > 99) {
            fps = 99;
        }
    }
    n = fps;
    Draw_Text(0, offset, WHITE, 0.35f, false, "FPS: %i", n);
}
开发者ID:directhex,项目名称:doom64,代码行数:26,代码来源:d_devstat.c


示例10: SCR_DisplayTicRate

void SCR_DisplayTicRate(void)
{
	tic_t i;
	tic_t ontic = I_GetTime();
	tic_t totaltics = 0;
	INT32 ticcntcolor = 0;

	for (i = lasttic + 1; i < TICRATE+lasttic && i < ontic; ++i)
		fpsgraph[i % TICRATE] = false;

	fpsgraph[ontic % TICRATE] = true;

	for (i = 0;i < TICRATE;++i)
		if (fpsgraph[i])
			++totaltics;

	if (totaltics <= TICRATE/2) ticcntcolor = V_REDMAP;
	else if (totaltics == TICRATE) ticcntcolor = V_GREENMAP;

	V_DrawString(vid.width-(24*vid.dupx), vid.height-(16*vid.dupy),
		V_YELLOWMAP|V_NOSCALESTART, "FPS");
	V_DrawString(vid.width-(40*vid.dupx), vid.height-( 8*vid.dupy),
		ticcntcolor|V_NOSCALESTART, va("%02d/%02u", totaltics, TICRATE));

	lasttic = ontic;
}
开发者ID:TehRealSalt,项目名称:SRB2,代码行数:26,代码来源:screen.c


示例11: D_WipeDraw

void D_WipeDraw()
{
	int				wipestart;
	boolean			done;

	 wipestart = I_GetTime () - 1;

	// MIKE 11/08 don't busy wait here during wipes, let Flash update
   /* do
    {
	do
	{
	    nowtime = I_GetTime ();
	    tics = nowtime - wipestart;
	} while (!tics);
	wipestart =		nowtime;*/
	done = wipe_ScreenWipe(wipe_Melt
			       , 0, 0, SCREENWIDTH, SCREENHEIGHT, 1);
	if(done)wipe = false;	// MIKE 11/08

	I_UpdateNoBlit ();
	M_Drawer ();                            // menu is drawn even on top of wipes
	I_FinishUpdate ();                      // page flip or blit buffer
    //} while (!done);
}
开发者ID:BruceJawn,项目名称:flash-doom,代码行数:25,代码来源:d_main.c


示例12: D_ProcessEvents

//
// D_ProcessEvents
// Send all the events of the given timestamp down the responder chain
//
void D_ProcessEvents (void)
{
    event_t *ev;

    // [RH] If testing mode, do not accept input until test is over
    if (testingmode)
    {
        if (testingmode <= I_GetTime())
        {
            M_RestoreMode ();
        }
        else
        {
            M_ModeFlashTestText();
        }

        return;
    }

    for (; eventtail != eventhead ; eventtail = ++eventtail<MAXEVENTS ? eventtail : 0)
    {
        ev = &events[eventtail];
        if (C_Responder (ev))
            continue;				// console ate the event
        if (M_Responder (ev))
            continue;				// menu ate the event
        G_Responder (ev);
    }
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:33,代码来源:d_main.cpp


示例13: D_DoomLoop

//
// D_DoomLoop
//
void D_DoomLoop (void)
{
	while (1)
	{
		try
		{
			SV_RunTics (); // will run at least one tic
		}
		catch (CRecoverableError &error)
		{
			Printf (PRINT_HIGH, "ERROR: %s\n", error.GetMessage().c_str());
			Printf (PRINT_HIGH, "sleeping for 10 seconds before map reload...");

			// denis - drop clients
			SV_SendDisconnectSignal();

			// denis - sleep to conserve server resources (in case of recurring problem)
			I_WaitForTic(I_GetTime() + 1000*10/TICRATE);

			// denis - reload with current settings
			G_ChangeMap ();

			// denis - todo - throw I_FatalError if this keeps happening
		}
	}
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:29,代码来源:d_main.cpp


示例14: NET_SDL_SendPacket

static void NET_SDL_SendPacket(net_addr_t *addr, net_packet_t *packet)
{
    UDPpacket sdl_packet;
    IPaddress ip;
   
    if (addr == &net_broadcast_addr)
    {
        SDLNet_ResolveHost(&ip, NULL, port);
        ip.host = INADDR_BROADCAST;
    }
    else
    {
        ip = *((IPaddress *) addr->handle);
    }

#if 0
    {
        static int this_second_sent = 0;
        static int lasttime;

        this_second_sent += packet->len + 64;

        if (I_GetTime() - lasttime > TICRATE)
        {
            printf("%i bytes sent in the last second\n", this_second_sent);
            lasttime = I_GetTime();
            this_second_sent = 0;
        }
    }
#endif

#ifdef DROP_PACKETS
    if ((rand() % 4) == 0)
        return;
#endif

    sdl_packet.channel = 0;
    sdl_packet.data = packet->data;
    sdl_packet.len = packet->len;
    sdl_packet.address = ip;

    if (!SDLNet_UDP_Send(udpsocket, -1, &sdl_packet))
    {
        I_Error("NET_SDL_SendPacket: Error transmitting packet: %s",
                SDLNet_GetError());
    }
}
开发者ID:hifi-unmaintained,项目名称:chocolate-doom-launcher,代码行数:47,代码来源:net_sdl.c


示例15: Net_AckTicker

// resend the data if needed
void Net_AckTicker(void)
{
#ifndef NONET
	INT32 i;

	for (i = 0; i < MAXACKPACKETS; i++)
	{
		const INT32 nodei = ackpak[i].destinationnode;
		node_t *node = &nodes[nodei];
#ifdef NEWPING
		if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime())
#else
		if (ackpak[i].acknum && ackpak[i].senttime + node->timeout < I_GetTime())
#endif
		{
			if (ackpak[i].resentnum > 10 && (node->flags & CLOSE))
			{
				DEBFILE(va("ack %d sent 10 times so connection is supposed lost: node %d\n",
					i, nodei));
				Net_CloseConnection(nodei | FORCECLOSE);

				ackpak[i].acknum = 0;
				continue;
			}
#ifdef NEWPING
			DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
				NODETIMEOUT, I_GetTime()));
#else
			DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
				node->timeout, I_GetTime()));
#endif
			M_Memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
			ackpak[i].senttime = I_GetTime();
			ackpak[i].resentnum++;
			ackpak[i].nextacknum = node->nextacknum;
			retransmit++; // for stat
			HSendPacket((INT32)(node - nodes), false, ackpak[i].acknum,
				(size_t)(ackpak[i].length - BASEPACKETSIZE));
		}
	}

	for (i = 1; i < MAXNETNODES; i++)
	{
		// this is something like node open flag
		if (nodes[i].firstacktosend)
		{
			// we haven't sent a packet for a long time
			// acknowledge packet if needed
			if (nodes[i].lasttimeacktosend_sent + ACKTOSENDTIMEOUT < I_GetTime())
				Net_SendAcks(i);

			if (!(nodes[i].flags & CLOSE)
				&& nodes[i].lasttimepacketreceived + connectiontimeout < I_GetTime())
			{
				Net_ConnectionTimeout(i);
			}
		}
	}
#endif
}
开发者ID:HipsterLion,项目名称:SRB2,代码行数:61,代码来源:d_net.c


示例16: I_GetTime_SaveMS

void I_GetTime_SaveMS(void)
{
  if (!movement_smooth)
    return;

  tic_vars.start = I_GetTime(); // SDL_GetTicks();
  tic_vars.next = (unsigned int) ((tic_vars.start * tic_vars.msec + 1.0f) / tic_vars.msec);
  tic_vars.step = tic_vars.next - tic_vars.start;
开发者ID:Nekrofage,项目名称:Doom-Quake-1-Quake-2-for-Android,代码行数:8,代码来源:i_system.c


示例17: CheckAbort

//
// CheckAbort
//
void CheckAbort (void)
{
    event_t *ev;
    int		stoptic;
	
    stoptic = I_GetTime () + 2; 
    while (I_GetTime() < stoptic) 
	I_StartTic (); 
	
    I_StartTic ();
    for ( ; eventtail != eventhead 
	      ; eventtail = (++eventtail)&(MAXEVENTS-1) ) 
    { 
	ev = &events[eventtail]; 
	if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
	    I_Error ("Network game synchronization aborted.");
    } 
}
开发者ID:diquark,项目名称:PhDoom,代码行数:21,代码来源:d_net.c


示例18: I_StartDisplay

boolean I_StartDisplay(void)
{
  if (InDisplay)
    return false;

  start_displaytime = I_GetTime(); //DL_GetTicks();
  InDisplay = true;
  return true;
开发者ID:Nekrofage,项目名称:Doom-Quake-1-Quake-2-for-Android,代码行数:8,代码来源:i_system.c


示例19: Net_WaitAllAckReceived

// wait for all ackreturns with timeout in seconds
void Net_WaitAllAckReceived(UINT32 timeout)
{
#ifdef NONET
	(void)timeout;
#else
	tic_t tictac = I_GetTime();
	timeout = tictac + timeout*NEWTICRATE;

	HGetPacket();
	while (timeout > I_GetTime() && !Net_AllAckReceived())
	{
		while (tictac == I_GetTime())
			I_Sleep();
		tictac = I_GetTime();
		HGetPacket();
		Net_AckTicker();
	}
#endif
}
开发者ID:HipsterLion,项目名称:SRB2,代码行数:20,代码来源:d_net.c


示例20: I_FinishUpdate

//
// I_FinishUpdate
//
void I_FinishUpdate (void)
{
    static int	lasttic;
    int		tics;
    int		i;
    // UNUSED static unsigned char *bigscreen=0;

    if (!initialized)
        return;

    if (noblit)
        return;
    
    UpdateGrab();

    // Don't update the screen if the window isn't visible.
    // Not doing this breaks under Windows when we alt-tab away 
    // while fullscreen.

    if (!(SDL_GetAppState() & SDL_APPACTIVE))
        return;

    // draws little dots on the bottom of the screen
    if (devparm)
    {

	i = I_GetTime();
	tics = i - lasttic;
	lasttic = i;
	if (tics > 20) tics = 20;

	for (i=0 ; i<tics*2 ; i+=4)
	    screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
	for ( ; i<20*4 ; i+=4)
	    screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
    
    }

    // draw to screen

    BlitArea(0, 0, SCREENWIDTH, SCREENHEIGHT);
    
    // If we have a palette to set, the act of setting the palette
    // updates the screen

    if (palette_to_set)
    {
        SDL_SetColors(screen, palette, 0, 256);
        palette_to_set = false;
    }
    else
    {
        SDL_Flip(screen);
    }
}
开发者ID:hifi-unmaintained,项目名称:chocolate-doom-launcher,代码行数:58,代码来源:i_video.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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