本文整理汇总了C++中ioport_list::first方法的典型用法代码示例。如果您正苦于以下问题:C++ ioport_list::first方法的具体用法?C++ ioport_list::first怎么用?C++ ioport_list::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ioport_list
的用法示例。
在下文中一共展示了ioport_list::first方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: output_switches
void info_xml_creator::output_switches(const ioport_list &portlist, int type, const char *outertag, const char *innertag)
{
// iterate looking for DIP switches
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
if (field->type == type)
{
// output the switch name information
fprintf(m_output, "\t\t<%s name=\"%s\"", outertag, xml_normalize_string(input_field_name(field)));
fprintf(m_output, " tag=\"%s\"", xml_normalize_string(field->port().tag()));
fprintf(m_output, " mask=\"%u\"", field->mask);
fprintf(m_output, ">\n");
// loop over settings
for (input_setting_config *setting = field->settinglist().first(); setting != NULL; setting = setting->next())
{
fprintf(m_output, "\t\t\t<%s name=\"%s\"", innertag, xml_normalize_string(setting->name));
fprintf(m_output, " value=\"%u\"", setting->value);
if (setting->value == field->defvalue)
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
}
// terminate the switch entry
fprintf(m_output, "\t\t</%s>\n", outertag);
}
}
示例2: output_categories
void info_xml_creator::output_categories(const ioport_list &portlist)
{
// iterate looking for Categories
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
if (field->type == IPT_CATEGORY)
{
// output the category name information
fprintf(m_output, "\t\t<category name=\"%s\">\n", xml_normalize_string(input_field_name(field)));
// loop over item settings
for (input_setting_config *setting = field->settinglist().first(); setting != NULL; setting = setting->next())
{
fprintf(m_output, "\t\t\t<item name=\"%s\"", xml_normalize_string(setting->name));
if (setting->value == field->defvalue)
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
}
// terminate the category entry
fprintf(m_output, "\t\t</category>\n");
}
}
示例3: output_input
void info_xml_creator::output_input(const ioport_list &portlist)
{
// enumerated list of control types
enum
{
ANALOG_TYPE_JOYSTICK,
ANALOG_TYPE_DIAL,
ANALOG_TYPE_TRACKBALL,
ANALOG_TYPE_PADDLE,
ANALOG_TYPE_LIGHTGUN,
ANALOG_TYPE_PEDAL,
ANALOG_TYPE_COUNT
};
// directions
const UINT8 DIR_LEFTRIGHT = 0x01;
const UINT8 DIR_UPDOWN = 0x02;
const UINT8 DIR_4WAY = 0x04;
const UINT8 DIR_DUAL = 0x08;
// initialize the list of control types
struct
{
const char * type; /* general type of input */
bool analog;
bool keyb;
INT32 min; /* analog minimum value */
INT32 max; /* analog maximum value */
INT32 sensitivity; /* default analog sensitivity */
INT32 keydelta; /* default analog keydelta */
bool reverse; /* default analog reverse setting */
} control_info[ANALOG_TYPE_COUNT];
memset(&control_info, 0, sizeof(control_info));
// tracking info as we iterate
int nplayer = 0;
int nbutton = 0;
int ncoin = 0;
UINT8 joytype = 0;
bool service = false;
bool tilt = false;
bool keypad = false;
bool keyboard = false;
// iterate over the ports
for (input_port_config *port = portlist.first(); port != NULL; port = port->next())
for (input_field_config *field = port->fieldlist().first(); field != NULL; field = field->next())
{
int analogtype = -1;
// track the highest player number
if (nplayer < field->player + 1)
nplayer = field->player + 1;
// switch off of the type
switch (field->type)
{
// map which joystick directions are present
case IPT_JOYSTICKRIGHT_LEFT:
case IPT_JOYSTICKRIGHT_RIGHT:
case IPT_JOYSTICKLEFT_LEFT:
case IPT_JOYSTICKLEFT_RIGHT:
joytype |= DIR_DUAL;
// fall through...
case IPT_JOYSTICK_LEFT:
case IPT_JOYSTICK_RIGHT:
joytype |= DIR_LEFTRIGHT | ((field->way == 4) ? DIR_4WAY : 0);
break;
case IPT_JOYSTICKRIGHT_UP:
case IPT_JOYSTICKRIGHT_DOWN:
case IPT_JOYSTICKLEFT_UP:
case IPT_JOYSTICKLEFT_DOWN:
joytype |= DIR_DUAL;
// fall through...
case IPT_JOYSTICK_UP:
case IPT_JOYSTICK_DOWN:
joytype |= DIR_UPDOWN | ((field->way == 4) ? DIR_4WAY : 0);
break;
// mark as an analog input, and get analog stats after switch
case IPT_PADDLE:
control_info[analogtype = ANALOG_TYPE_PADDLE].type = "paddle";
break;
case IPT_DIAL:
control_info[analogtype = ANALOG_TYPE_DIAL].type = "dial";
analogtype = ANALOG_TYPE_DIAL;
break;
case IPT_TRACKBALL_X:
case IPT_TRACKBALL_Y:
control_info[analogtype = ANALOG_TYPE_TRACKBALL].type = "trackball";
analogtype = ANALOG_TYPE_TRACKBALL;
break;
case IPT_AD_STICK_X:
//.........这里部分代码省略.........