当前位置: 首页>>代码示例>>C++>>正文


C++ con_printf函数代码示例

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


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

示例1: main

int main(int argc, char **argv) {

    struct import * hDll;
    int a,b,c,d;

    if((hDll = (struct import *)_ksys_cofflib_load(dllname)) == 0) {
        debug_out_str("can't load lib\n");
        return 1;
    }
    link(hDll, imports);
    debug_out_str("dll loaded\n");

    if(dll_start(1) == 0) {
        debug_out_str("dll_start failed\n");
        return 1;
    }

    con_init(-1, -1, -1, -1, caption);

    for(i = 0; i < 256; i++) {
        con_printf("Color 0x%02X: ", i);
        con_write_asciiz("Text sample.");

        con_printf("  printf %s test %d\n", "small", i);

    }

    con_exit(0);
    debug_out_str("all right's ;)\n");
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:30,代码来源:console.c

示例2: mem_check_integrity

int mem_check_integrity( int block_number )
{
	int i, ErrorCount;
	ubyte * CheckData;

	CheckData = (ubyte *)((char *)MallocBase[block_number] + MallocSize[block_number]);

	ErrorCount = 0;
			
	for (i=0; i<CHECKSIZE; i++ )
		if (CheckData[i] != CHECKBYTE ) {
			ErrorCount++;
			con_printf(CON_CRITICAL, "OA: %p ", &CheckData[i] );
		}

	if (ErrorCount &&  (!out_of_memory))	{
		con_printf(CON_CRITICAL, "\nMEM_OVERWRITE: Memory after the end of allocated block overwritten.\n" );
		PrintInfo( block_number );
		con_printf(CON_CRITICAL, "\t%d/%d check bytes were overwritten.\n", ErrorCount, CHECKSIZE );
		Int3();
	}

	return ErrorCount;

}
开发者ID:jihnsius,项目名称:d2r,代码行数:25,代码来源:mem.c

示例3: cmd_recdemo

void cmd_recdemo(){
    // Begins recording a demo.
    int m;

    // Check if we're allready recording/playing.
    if(player_connected!=1||map_type!=MAP_IWAD){
        con_printf("not connected to an iwad map");
        return;
    }
    if(player_recording!=0){
        con_printf("demo buffers in use");
        return;
    }
    if(internal_setdemoname(parse_words[1])==0){
        // Initiate the demo.
        m=sizeof(DEMO_CELL)*10000;
        bufdemo=(DEMO_CELL *)malloc(m);
        demo_count=0;
        demo_header.ver=DJDOOM_VER;
        strcpy(demo_header.mapname,mapname);

        // Display recording statistics.
        sprintf(saybuf,"version %d demo (%s)",demo_header.ver,demo_header.mapname);
        con_printf(saybuf);
        player_recording=1;
    }
    else{
        con_printf("bad demo name");
    }
}
开发者ID:amcgregor,项目名称:raven,代码行数:30,代码来源:cmds.c

示例4: digi_mixer_init

/* Initialise audio */
int digi_mixer_init() {
  digi_sample_rate = SAMPLE_RATE_44K;

  if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"digi_init %d (SDL_Mixer)\n", MAX_SOUNDS);
  if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) Error("SDL audio initialisation failed: %s.", SDL_GetError());

  if (Mix_OpenAudio(digi_sample_rate, MIX_OUTPUT_FORMAT, MIX_OUTPUT_CHANNELS, SOUND_BUFFER_SIZE)) {
    //edited on 10/05/98 by Matt Mueller - should keep running, just with no sound.
    con_printf(CON_URGENT,"\nError: Couldn't open audio: %s\n", SDL_GetError());
    GameArg.SndNoSound = 1;
    return 1;
  }

  Mix_AllocateChannels(digi_max_channels);
  Mix_Pause(0);

  // Attempt to load jukebox
  jukebox_load();
  //jukebox_list();

  digi_initialised = 1;

  oplmus_init();

  return 0;
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:27,代码来源:digi_mixer.c

示例5: IPXOpenSocket

static int IPXOpenSocket(socket_t *sk, int port)
{
    int sock;			/* sock here means Linux socket handle */
    int opt;
    struct sockaddr_ipx ipxs;
    socklen_t len;
    struct sockaddr_ipx ipxs2;

    /* do a socket call, then bind to this port */
    sock = socket(AF_IPX, SOCK_DGRAM, PF_IPX);
    if (sock == -1) {
        con_printf(CON_URGENT,"IPX: could not open IPX socket.\n");
        return -1;
    }

    opt = 1;
    /* Permit broadcast output */
    if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(opt)) == -1)
    {
        con_printf(CON_URGENT,"IPX: could not set socket option for broadcast.\n");
        return -1;
    }

    ipxs.sipx_family = AF_IPX;
    ipxs.sipx_network = *((unsigned int *)&MyAddress[0]);
    /*  ipxs.sipx_network = htonl(MyNetwork); */
    bzero(ipxs.sipx_node, 6);	/* Please fill in my node name */
    ipxs.sipx_port = htons(port);

    /* now bind to this port */
    if (bind(sock, (struct sockaddr *) &ipxs, sizeof(ipxs)) == -1)
    {
        con_printf(CON_URGENT,"IPX: could not bind socket to address\n");
        close( sock );
        return -1;
    }

    if( port==0 )
    {
        len = sizeof(ipxs2);
        if (getsockname(sock,(struct sockaddr *)&ipxs2,&len) < 0)
        {
            con_printf(CON_URGENT,"IPX: could not get socket name in IPXOpenSocket\n");
            close( sock );
            return -1;
        }
        else
        {
            port = htons(ipxs2.sipx_port);
            con_printf(CON_URGENT,"IPX: opened dynamic socket %04x\n", port);
        }
    }

    sk->fd = sock;
    sk->socket = port;

    IPXGetMyAddress();

    return 0;
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:60,代码来源:netdrv_ipx.c

示例6: clcmd_help

static void clcmd_help(int s, char *arg)
{
	unsigned int i;
	con_printf("Command List:\n");
	for(i = 0; i < sizeof(command)/sizeof(*command); i++)
		con_printf(" %s: %s\n", command[i].name, command[i].help);
}
开发者ID:giannitedesco,项目名称:blackbloc,代码行数:7,代码来源:cl_cmd.c

示例7: RBAInit

void RBAInit()
{
	int num_cds;
	int i,j;
	
	if (initialised) return;

	if (SDL_Init(SDL_INIT_CDROM) < 0)
	{
		Warning("SDL library initialisation failed: %s.",SDL_GetError());
		return;
	}

	num_cds = SDL_CDNumDrives();
	if (num_cds < 1)
	{
		con_printf(CON_NORMAL, "No cdrom drives found!\n");
#if defined(__APPLE__) || defined(macintosh)
		SDL_QuitSubSystem(SDL_INIT_CDROM);	// necessary for rescanning CDROMs
#endif
		return;
	}
	
	for (i = 0; i < num_cds; i++)
	{
		if (s_cd)
			SDL_CDClose(s_cd);
		s_cd = SDL_CDOpen(i);
		
		if (s_cd && CD_INDRIVE(SDL_CDStatus(s_cd)))
		{
			for (j = 0; j < s_cd->numtracks; j++)
			{
				if (s_cd->track[j].type == SDL_AUDIO_TRACK)
					break;
			}
			
			if (j != s_cd->numtracks)
				break;	// we've found an audio CD
		}
		else if (s_cd == NULL)
			Warning("Could not open cdrom %i for redbook audio:%s\n", i, SDL_GetError());
	}
	
	if (i == num_cds)
	{
		con_printf(CON_NORMAL, "No audio CDs found\n");
		if (s_cd)	// if there's no audio CD, say that there's no redbook and hence play MIDI instead
		{
			SDL_CDClose(s_cd);
			s_cd = NULL;
		}
#if defined(__APPLE__) || defined(macintosh)
		SDL_QuitSubSystem(SDL_INIT_CDROM);	// necessary for rescanning CDROMs
#endif
		return;
	}
	
	initialised = 1;
}
开发者ID:Foran,项目名称:dxx-rebirth,代码行数:60,代码来源:rbaudio.cpp

示例8: pthread_setcanceltype

void *mixer_thread(void *data) {
 int err;
 ubyte buffer[SOUND_BUFFER_SIZE];

 /* Allow ourselves to be asynchronously cancelled */
 pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
 while (1) {

   memset(buffer, 0x80, SOUND_BUFFER_SIZE);
   LOCK();
   audio_mixcallback(NULL,buffer,SOUND_BUFFER_SIZE);
   UNLOCK();
again:
   err = snd_pcm_writei(snd_devhandle, buffer, SOUND_BUFFER_SIZE/2);

   if (err == -EPIPE) {
        // Sound buffer underrun
        err = snd_pcm_prepare(snd_devhandle);
        if (err < 0) {
            con_printf(CON_CRITICAL, "Can't recover from underrun: %s\n",
                    snd_strerror(err));
        }
   } else if (err == -EAGAIN) {
        goto again;
   } else if (err != SOUND_BUFFER_SIZE/2) {
        // Each frame has size 2 bytes - hence we expect SOUND_BUFFER_SIZE/2
        // frames to be written.
        con_printf(CON_CRITICAL, "Unknown err %d: %s\n", err, snd_strerror(err));
   }
 } 
 return 0;
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:32,代码来源:alsadigi.c

示例9: mixdigi_convert_sound

/*
 * Play-time conversion. Performs output conversion only once per sound effect used.
 * Once the sound sample has been converted, it is cached in SoundChunks[]
 */
void mixdigi_convert_sound(int i) {

  SDL_AudioCVT cvt;
  Uint8 *data = GameSounds[i].data;
  Uint32 dlen = GameSounds[i].length;
  int freq = GameSounds[i].freq;
  //int bits = GameSounds[i].bits;

  if (SoundChunks[i].abuf) return; //proceed only if not converted yet

  if (data) {
    if (MIX_DIGI_DEBUG) con_printf(CON_DEBUG,"converting %d (%d)\n", i, dlen);
    SDL_BuildAudioCVT(&cvt, AUDIO_U8, 1, freq, MIX_OUTPUT_FORMAT, MIX_OUTPUT_CHANNELS, digi_sample_rate);

    cvt.buf = malloc(dlen * cvt.len_mult);
    cvt.len = dlen;
    memcpy(cvt.buf, data, dlen);
    if (SDL_ConvertAudio(&cvt)) con_printf(CON_DEBUG,"conversion of %d failed\n", i);

    SoundChunks[i].abuf = cvt.buf;
    SoundChunks[i].alen = dlen * cvt.len_mult;
    SoundChunks[i].allocated = 1;
    SoundChunks[i].volume = 128; // Max volume = 128
  }
}
开发者ID:arbruijn,项目名称:d1xnacl,代码行数:29,代码来源:digi_mixer.c

示例10: RBASetVolume

void RBASetVolume(int volume)
{
#ifdef __linux__
	int cdfile, level;
	struct cdrom_volctrl volctrl;

	if (!s_cd) return;

	cdfile = s_cd->id;
	level = volume*REDBOOK_VOLUME_SCALE/8;

	if ((level<0) || (level>REDBOOK_VOLUME_SCALE)) {
		con_printf(CON_CRITICAL, "illegal volume value (allowed values 0-%i)\n",REDBOOK_VOLUME_SCALE);
		return;
	}

	volctrl.channel0
		= volctrl.channel1
		= volctrl.channel2
		= volctrl.channel3
		= level;
	if ( ioctl(cdfile, CDROMVOLCTRL, &volctrl) == -1 ) {
		con_printf(CON_CRITICAL, "CDROMVOLCTRL ioctl failed\n");
		return;
	}
#else
	volume;
#endif
}
开发者ID:Foran,项目名称:dxx-rebirth,代码行数:29,代码来源:rbaudio.cpp

示例11: clipboard_set_text

/**
 * Copy @p text to the clipboard
 *
 * @param[in]       text        Text to copy to the clipboard
 *
 * @retval          true        On success
 * @retval          false       If any of the Windows clipboard functions failed
 */
bool clipboard_set_text(char *text)
{
    bool retval;
    HGLOBAL hdst;
    char *dst;

    DWORD dst_sz = strlen(text) + sizeof('\0');

    /* Allocate and copy the string to the global memory */
    hdst = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, dst_sz);
    dst = (char *)GlobalLock(hdst);
    util_strlcpy(dst, text, dst_sz);
    GlobalUnlock(hdst);

    /* Set clipboard data */
    retval = OpenClipboard(NULL);
    if (!retval)
    {
        con_printf("Error opening clipboard\n");
        return false;
    }

    EmptyClipboard();

    retval = SetClipboardData(CF_TEXT, hdst);
    if (!retval)
    {
        con_printf("Error pasting to clipboard\n");
        return false;
    }

    CloseClipboard();
    return true;
}
开发者ID:CeeJay79,项目名称:apme,代码行数:42,代码来源:util.c

示例12: drp_debug3

void drp_debug3(void){
    int value=0, res=0;
    unsigned int index;
    unsigned long block;

    con_printf("(Destructive) Testing -256block r/w- memSD\r\n");
    for(block=0; block<1024; block=block+256){
        printf("testing 256Block = %lu\n", block);

        value=20000;
        for(index=0; index<=0xFFFF; index++, value++){

            con_printf("writing: ");
            msd_setVar_256BlockExtMem( block, index, value);
            printf("value[%u] = %d    |    ", index, value);

            printf("reading: ");
            msd_getVar_256BlockExtMem( block, index, &res);
            printf("value[%u] = %d    |    ", index, res);

            printf("comparing: ");
            if( value==res ){ printf("ok\n"); }
            else{ con_printf("fail\n"); return; }

            ClrWdt();
        }
    }
    //drp_memSD_BlockErase();
}
开发者ID:keimi,项目名称:SUCHAI,代码行数:29,代码来源:cmdDRP.c

示例13: sys_runas_admin

/**
 * Execute process @p path with admin privileges
 *
 * @note This function will trigger the UAC dialog
 *
 * @param[in]   path    Path to the executable
 *
 * @retval      true    If process was executed successfully
 * @retval      false   On error, or if the user declined the UAC
 */
bool sys_runas_admin(char *path)
{
    BOOL success;
    SHELLEXECUTEINFO shexe_info;

    bool isadmin = false;

    printf("Trying to execute '%s' as admin!\n", path);
    /* Check if we're already admin */
    if (!sys_is_admin(&isadmin))
    {
        con_printf("Unable to determine if we're running elevated.\n");
        return false;
    }

    if (isadmin)
    {
        con_printf("Unable to execute %s as we're already elevated.\n", path);
        return false;
    }

    /* Do the undocumented "runas" trick of ShellExecute() */
    memset(&shexe_info, 0, sizeof(shexe_info));
    shexe_info.cbSize = sizeof(shexe_info);

    shexe_info.lpVerb = "runas";
    shexe_info.lpFile = path;
    shexe_info.nShow = SW_MAXIMIZE;

    success = ShellExecuteEx(&shexe_info);
    return (success == TRUE);
}
开发者ID:CeeJay79,项目名称:apme,代码行数:42,代码来源:util.c

示例14: gr_close

void gr_close()
{
	ogl_brightness_r = ogl_brightness_g = ogl_brightness_b = 0;

	if (gl_initialized)
	{
		ogl_smash_texture_list_internal();
	}

	if (grd_curscreen)
	{
		if (grd_curscreen->sc_canvas.cv_bitmap.bm_data)
			d_free(grd_curscreen->sc_canvas.cv_bitmap.bm_data);
		d_free(grd_curscreen);
	}
	ogl_close_pixel_buffers();
#ifdef _WIN32
	if (ogl_rt_loaded)
		OpenGL_LoadLibrary(false);
#endif

#ifdef OGLES
	ogles_destroy();
#ifdef RPI
	con_printf(CON_DEBUG, "RPi: cleanuing up\n");
	if (dispman_display != DISPMANX_NO_HANDLE) {
		rpi_destroy_element();
		con_printf(CON_DEBUG, "RPi: closing display\n");
		vc_dispmanx_display_close(dispman_display);
		dispman_display = DISPMANX_NO_HANDLE;
	}
#endif
#endif
}
开发者ID:CDarrow,项目名称:DXX-Retro,代码行数:34,代码来源:gr.c

示例15: internal_set_gfx_mode

void internal_set_gfx_mode(){
    // Actually sets the graphics mode.
    int error,n=player_gfx_mode-1;

    // Try to set the graphics mode (unless we're allready in it).
    if(n!=old_gfx_mode){
        error=set_gfx_mode(GFX_AUTODETECT,gfx_mode_info[n].width,gfx_mode_info[n].height,0,0);
        if(error<0){
            // DEBUG: Will this error even appear in a bad graphics mode?
            con_printf("Couldn't initiate the graphics mode!");
        }
        else{
            // Get the new screen width/height.
            screen_width=gfx_mode_info[n].width;
            screen_height=gfx_mode_info[n].height;
            set_palette(gamma_pal);

            // DEBUG: Shouldn't we free the old VGABUF?!!
            vgabuf=create_bitmap(screen_width,screen_height);
            sprintf(saybuf,"%d x %d mode set (%dk vgabuf)",screen_width,screen_height,screen_width*screen_height/1024);
            con_printf(saybuf);

            // Reset the console height, if the console is down.
            if(player_connected==1&&player_con==1){
                con_height=screen_height/2;
            }
        }
    }

    // Save the old mode.
    old_gfx_mode=n;
}
开发者ID:amcgregor,项目名称:raven,代码行数:32,代码来源:cmds.c


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