Previous 199869 Revisions Next

r29427 Tuesday 8th April, 2014 at 00:07:02 UTC by Nathan Woods
Resolving conflict
[/branches/new_menus/src/emu/ui]ui.c

branches/new_menus/src/emu/ui/ui.c
r29426r29427
212212   ui_menu::init(machine);
213213   ui_gfx_init(machine);
214214
215<<<<<<< HEAD
216   // reset instance variables
217   m_menubar = NULL;
218=======
219215   // reset instance variables
220>>>>>>> b8b662877e2b80cf9607b7d23a72942cf61c2032
216   m_menubar = NULL;
221217   m_font = NULL;
222218   m_handler_callback = NULL;
223219   m_handler_param = 0;
r29426r29427
14391435
14401436UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *container, UINT32 state)
14411437{
1442<<<<<<< HEAD
14431438   return machine.ui().handler_ingame_method(container, state);
14441439}
14451440
r29426r29427
14481443//  handler_ingame_method - in-game handler takes
14491444//  care of the standard keypresses
14501445//-------------------------------------------------
1451=======
1452   bool is_paused = machine.paused();
14531446
1454   // first draw the FPS counter
1455   if (machine.ui().show_fps_counter())
1456   {
1457      astring tempstring;
1458      machine.ui().draw_text_full(container, machine.video().speed_text(tempstring), 0.0f, 0.0f, 1.0f,
1459               JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
1460   }
1461
1462   // draw the profiler if visible
1463   if (machine.ui().show_profiler())
1464   {
1465      const char *text = g_profiler.text(machine);
1466      machine.ui().draw_text_full(container, text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
1467   }
1468
1469   // if we're single-stepping, pause now
1470   if (machine.ui().single_step())
1471   {
1472      machine.pause();
1473      machine.ui().set_single_step(false);
1474   }
1475
1476   // determine if we should disable the rest of the UI
1477   bool ui_disabled = (machine.ioport().has_keyboard() && !machine.ui_active());
1478
1479   // is ScrLk UI toggling applicable here?
1480   if (machine.ioport().has_keyboard())
1481   {
1482      // are we toggling the UI with ScrLk?
1483      if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI))
1484      {
1485         // toggle the UI
1486         machine.set_ui_active(!machine.ui_active());
1487
1488         // display a popup indicating the new status
1489         if (machine.ui_active())
1490         {
1491            machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
1492               "Keyboard Emulation Status",
1493               "-------------------------",
1494               "Mode: PARTIAL Emulation",
1495               "UI:   Enabled",
1496               "-------------------------",
1497               "**Use ScrLock to toggle**");
1498         }
1499         else
1500         {
1501            machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n",
1502               "Keyboard Emulation Status",
1503               "-------------------------",
1504               "Mode: FULL Emulation",
1505               "UI:   Disabled",
1506               "-------------------------",
1507               "**Use ScrLock to toggle**");
1508         }
1509      }
1510   }
1511
1512   // is the natural keyboard enabled?
1513   if (machine.ui().use_natural_keyboard() && (machine.phase() == MACHINE_PHASE_RUNNING))
1514      machine.ui().process_natural_keyboard();
1515
1516   if (!ui_disabled)
1517   {
1518      // paste command
1519      if (ui_input_pressed(machine, IPT_UI_PASTE))
1520         machine.ui().paste();
1521   }
1522
1523   machine.ui().image_handler_ingame();
1524
1525   if (ui_disabled) return ui_disabled;
1526
1527   if (ui_input_pressed(machine, IPT_UI_CANCEL))
1528   {
1529      machine.ui().request_quit();
1530      return 0;
1531   }
1532
1533   // turn on menus if requested
1534   if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
1535      return machine.ui().set_handler(ui_menu::ui_handler, 0);
1536
1537   // if the on-screen display isn't up and the user has toggled it, turn it on
1538   if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY))
1539      return machine.ui().set_handler(ui_menu_sliders::ui_handler, 1);
1540
1541   // handle a reset request
1542   if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE))
1543      machine.schedule_hard_reset();
1544   if (ui_input_pressed(machine, IPT_UI_SOFT_RESET))
1545      machine.schedule_soft_reset();
1546
1547   // handle a request to display graphics/palette
1548   if (ui_input_pressed(machine, IPT_UI_SHOW_GFX))
1549   {
1550      if (!is_paused)
1551         machine.pause();
1552      return machine.ui().set_handler(ui_gfx_ui_handler, is_paused);
1553   }
1554
1555   // handle a save state request
1556   if (ui_input_pressed(machine, IPT_UI_SAVE_STATE))
1557   {
1558      machine.pause();
1559      return machine.ui().set_handler(handler_load_save, LOADSAVE_SAVE);
1560   }
1561
1562   // handle a load state request
1563   if (ui_input_pressed(machine, IPT_UI_LOAD_STATE))
1564   {
1565      machine.pause();
1566      return machine.ui().set_handler(handler_load_save, LOADSAVE_LOAD);
1567   }
1568
1569   // handle a save snapshot request
1570   if (ui_input_pressed(machine, IPT_UI_SNAPSHOT))
1571      machine.video().save_active_screen_snapshots();
1572
1573   // toggle pause
1574   if (ui_input_pressed(machine, IPT_UI_PAUSE))
1575   {
1576      // with a shift key, it is single step
1577      if (is_paused && (machine.input().code_pressed(KEYCODE_LSHIFT) || machine.input().code_pressed(KEYCODE_RSHIFT)))
1578      {
1579         machine.ui().set_single_step(true);
1580         machine.resume();
1581      }
1582      else
1583         machine.toggle_pause();
1584   }
1585
1586   // handle a toggle cheats request
1587   if (ui_input_pressed(machine, IPT_UI_TOGGLE_CHEAT))
1588      machine.cheat().set_enable(!machine.cheat().enabled());
1589
1590   // toggle movie recording
1591   if (ui_input_pressed(machine, IPT_UI_RECORD_MOVIE))
1592      machine.video().toggle_record_movie();
1593
1594   // toggle profiler display
1595   if (ui_input_pressed(machine, IPT_UI_SHOW_PROFILER))
1596      machine.ui().set_show_profiler(!machine.ui().show_profiler());
1597
1598   // toggle FPS display
1599   if (ui_input_pressed(machine, IPT_UI_SHOW_FPS))
1600      machine.ui().set_show_fps(!machine.ui().show_fps());
1601
1602   // increment frameskip?
1603   if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_INC))
1604      machine.ui().increase_frameskip();
1605
1606   // decrement frameskip?
1607   if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_DEC))
1608      machine.ui().decrease_frameskip();
1609
1610   // toggle throttle?
1611   if (ui_input_pressed(machine, IPT_UI_THROTTLE))
1612      machine.video().toggle_throttle();
1613
1614   // check for fast forward
1615   if (machine.ioport().type_pressed(IPT_UI_FAST_FORWARD))
1616   {
1617      machine.video().set_fastforward(true);
1618      machine.ui().show_fps_temp(0.5);
1619   }
1620   else
1621      machine.video().set_fastforward(false);
1622>>>>>>> b8b662877e2b80cf9607b7d23a72942cf61c2032
1623
16241447UINT32 ui_manager::handler_ingame_method(render_container *container, UINT32 state)
16251448{
16261449   // no menubar? create it

Previous 199869 Revisions Next


© 1997-2024 The MAME Team