⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spin.cpp

📁 非常好用的五子棋游戏源码
💻 CPP
字号:
// Created:10-27-98
// By Jeff Connelly

// Spinning cursor function

// Set 'read_byte' global function pointer to a function containing a
// call to this and a call that actually reads the byte.  Example:
//     unsigned char my_read_byte()
//     {
//         spin();
//         return read_byte();
//     }

#include "stdafx.h"
#define EXPORTING
#include "comprlib.h"

// 'spin' "spins" the characters 'chars' after this is called 'speed' times.
// Default spin characters are |/-\, so it looks like it is spinning.
void EXPORT spin(int speed = 10, char chars[] = "|/-\\\0")
{
    static int counter = 0, index = 0;

    ++counter;
    ++index;

    if (counter == speed)
        counter = 0;
    else
        return;

    if (!chars[index])
        index = 0;

    printf ("%c\b", chars[index]);
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -