trunk/src/emu/render.h
| r250125 | r250126 | |
| 568 | 568 | }; |
| 569 | 569 | |
| 570 | 570 | |
| 571 | | #include "rendlay.h" |
| 572 | 571 | |
| 572 | //************************************************************************** |
| 573 | // CONSTANTS |
| 574 | //************************************************************************** |
| 575 | |
| 576 | enum item_layer |
| 577 | { |
| 578 | ITEM_LAYER_FIRST = 0, |
| 579 | ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST, |
| 580 | ITEM_LAYER_SCREEN, |
| 581 | ITEM_LAYER_OVERLAY, |
| 582 | ITEM_LAYER_BEZEL, |
| 583 | ITEM_LAYER_CPANEL, |
| 584 | ITEM_LAYER_MARQUEE, |
| 585 | ITEM_LAYER_MAX |
| 586 | }; |
| 587 | DECLARE_ENUM_OPERATORS(item_layer) |
| 588 | |
| 589 | |
| 590 | |
| 591 | //************************************************************************** |
| 592 | // TYPE DEFINITIONS |
| 593 | //************************************************************************** |
| 594 | |
| 595 | |
| 596 | // ======================> layout_element |
| 597 | |
| 598 | // a layout_element is a single named element, which may have multiple components |
| 599 | class layout_element |
| 600 | { |
| 601 | friend class simple_list<layout_element>; |
| 602 | |
| 603 | public: |
| 604 | // construction/destruction |
| 605 | layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname); |
| 606 | virtual ~layout_element(); |
| 607 | |
| 608 | // getters |
| 609 | layout_element *next() const { return m_next; } |
| 610 | const char *name() const { return m_name.c_str(); } |
| 611 | running_machine &machine() const { return m_machine; } |
| 612 | int default_state() const { return m_defstate; } |
| 613 | int maxstate() const { return m_maxstate; } |
| 614 | render_texture *state_texture(int state); |
| 615 | |
| 616 | private: |
| 617 | // a component represents an image, rectangle, or disk in an element |
| 618 | class component |
| 619 | { |
| 620 | friend class layout_element; |
| 621 | friend class simple_list<component>; |
| 622 | |
| 623 | public: |
| 624 | // construction/destruction |
| 625 | component(running_machine &machine, xml_data_node &compnode, const char *dirname); |
| 626 | ~component(); |
| 627 | |
| 628 | // getters |
| 629 | component *next() const { return m_next; } |
| 630 | const render_bounds &bounds() const { return m_bounds; } |
| 631 | |
| 632 | // operations |
| 633 | void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 634 | |
| 635 | private: |
| 636 | // component types |
| 637 | enum component_type |
| 638 | { |
| 639 | CTYPE_INVALID = 0, |
| 640 | CTYPE_IMAGE, |
| 641 | CTYPE_RECT, |
| 642 | CTYPE_DISK, |
| 643 | CTYPE_TEXT, |
| 644 | CTYPE_LED7SEG, |
| 645 | CTYPE_LED8SEG_GTS1, |
| 646 | CTYPE_LED14SEG, |
| 647 | CTYPE_LED16SEG, |
| 648 | CTYPE_LED14SEGSC, |
| 649 | CTYPE_LED16SEGSC, |
| 650 | CTYPE_DOTMATRIX, |
| 651 | CTYPE_DOTMATRIX5DOT, |
| 652 | CTYPE_DOTMATRIXDOT, |
| 653 | CTYPE_SIMPLECOUNTER, |
| 654 | CTYPE_REEL, |
| 655 | CTYPE_MAX |
| 656 | }; |
| 657 | |
| 658 | // helpers |
| 659 | void draw_rect(bitmap_argb32 &dest, const rectangle &bounds); |
| 660 | void draw_disk(bitmap_argb32 &dest, const rectangle &bounds); |
| 661 | void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds); |
| 662 | void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 663 | void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 664 | void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 665 | void load_bitmap(); |
| 666 | void load_reel_bitmap(int number); |
| 667 | void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 668 | void draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 669 | void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 670 | void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 671 | void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 672 | void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 673 | void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 674 | void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color); |
| 675 | void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color); |
| 676 | void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color); |
| 677 | void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color); |
| 678 | void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); |
| 679 | void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); |
| 680 | void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color); |
| 681 | void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); |
| 682 | void apply_skew(bitmap_argb32 &dest, int skewwidth); |
| 683 | |
| 684 | #define MAX_BITMAPS 32 |
| 685 | |
| 686 | // internal state |
| 687 | component * m_next; // link to next component |
| 688 | component_type m_type; // type of component |
| 689 | int m_state; // state where this component is visible (-1 means all states) |
| 690 | render_bounds m_bounds; // bounds of the element |
| 691 | render_color m_color; // color of the element |
| 692 | std::string m_string; // string for text components |
| 693 | int m_digits; // number of digits for simple counters |
| 694 | int m_textalign; // text alignment to box |
| 695 | bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images |
| 696 | std::string m_dirname; // directory name of image file (for lazy loading) |
| 697 | auto_pointer<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files |
| 698 | std::string m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) |
| 699 | std::string m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) |
| 700 | bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present? |
| 701 | |
| 702 | // stuff for fruit machine reels |
| 703 | // basically made up of multiple text strings / gfx |
| 704 | int m_numstops; |
| 705 | std::string m_stopnames[MAX_BITMAPS]; |
| 706 | int m_stateoffset; |
| 707 | int m_reelreversed; |
| 708 | int m_numsymbolsvisible; |
| 709 | int m_beltreel; |
| 710 | }; |
| 711 | |
| 712 | // a texture encapsulates a texture for a given element in a given state |
| 713 | class texture |
| 714 | { |
| 715 | public: |
| 716 | texture(); |
| 717 | ~texture(); |
| 718 | |
| 719 | layout_element * m_element; // pointer back to the element |
| 720 | render_texture * m_texture; // texture for this state |
| 721 | int m_state; // associated state number |
| 722 | }; |
| 723 | |
| 724 | // internal helpers |
| 725 | static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); |
| 726 | |
| 727 | // internal state |
| 728 | layout_element * m_next; // link to next element |
| 729 | running_machine & m_machine; // reference to the owning machine |
| 730 | std::string m_name; // name of this element |
| 731 | simple_list<component> m_complist; // list of components |
| 732 | int m_defstate; // default state of this element |
| 733 | int m_maxstate; // maximum state value for all components |
| 734 | std::vector<texture> m_elemtex; // array of element textures used for managing the scaled bitmaps |
| 735 | }; |
| 736 | |
| 737 | |
| 738 | // ======================> layout_view |
| 739 | |
| 740 | // a layout_view encapsulates a named list of items |
| 741 | class layout_view |
| 742 | { |
| 743 | friend class simple_list<layout_view>; |
| 744 | |
| 745 | public: |
| 746 | // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item |
| 747 | class item |
| 748 | { |
| 749 | friend class layout_view; |
| 750 | friend class simple_list<item>; |
| 751 | |
| 752 | public: |
| 753 | // construction/destruction |
| 754 | item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist); |
| 755 | virtual ~item(); |
| 756 | |
| 757 | // getters |
| 758 | item *next() const { return m_next; } |
| 759 | layout_element *element() const { return m_element; } |
| 760 | screen_device *screen() { return m_screen; } |
| 761 | const render_bounds &bounds() const { return m_bounds; } |
| 762 | const render_color &color() const { return m_color; } |
| 763 | int orientation() const { return m_orientation; } |
| 764 | render_container *screen_container(running_machine &machine) const; |
| 765 | bool has_input() const { return !m_input_tag.empty(); } |
| 766 | ioport_port *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_port; }; |
| 767 | |
| 768 | // fetch state based on configured source |
| 769 | int state() const; |
| 770 | |
| 771 | // resolve tags, if any |
| 772 | void resolve_tags(); |
| 773 | |
| 774 | private: |
| 775 | // internal state |
| 776 | item * m_next; // link to next item |
| 777 | layout_element * m_element; // pointer to the associated element (non-screens only) |
| 778 | std::string m_output_name; // name of this item |
| 779 | std::string m_input_tag; // input tag of this item |
| 780 | ioport_port * m_input_port; // input port of this item |
| 781 | ioport_value m_input_mask; // input mask of this item |
| 782 | screen_device * m_screen; // pointer to screen |
| 783 | int m_orientation; // orientation of this item |
| 784 | render_bounds m_bounds; // bounds of the item |
| 785 | render_bounds m_rawbounds; // raw (original) bounds of the item |
| 786 | render_color m_color; // color of the item |
| 787 | }; |
| 788 | |
| 789 | // construction/destruction |
| 790 | layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist); |
| 791 | virtual ~layout_view(); |
| 792 | |
| 793 | // getters |
| 794 | layout_view *next() const { return m_next; } |
| 795 | item *first_item(item_layer layer) const; |
| 796 | const char *name() const { return m_name.c_str(); } |
| 797 | const render_bounds &bounds() const { return m_bounds; } |
| 798 | const render_bounds &screen_bounds() const { return m_scrbounds; } |
| 799 | const render_screen_list &screens() const { return m_screens; } |
| 800 | bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; } |
| 801 | |
| 802 | // |
| 803 | bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); } |
| 804 | float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; } |
| 805 | |
| 806 | // operations |
| 807 | void recompute(render_layer_config layerconfig); |
| 808 | |
| 809 | // resolve tags, if any |
| 810 | void resolve_tags(); |
| 811 | |
| 812 | private: |
| 813 | // internal state |
| 814 | layout_view * m_next; // pointer to next layout in the list |
| 815 | std::string m_name; // name of the layout |
| 816 | float m_aspect; // X/Y of the layout |
| 817 | float m_scraspect; // X/Y of the screen areas |
| 818 | render_screen_list m_screens; // list of active screens |
| 819 | render_bounds m_bounds; // computed bounds of the view |
| 820 | render_bounds m_scrbounds; // computed bounds of the screens within the view |
| 821 | render_bounds m_expbounds; // explicit bounds of the view |
| 822 | bool m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled? |
| 823 | simple_list<item> m_backdrop_list; // list of backdrop items |
| 824 | simple_list<item> m_screen_list; // list of screen items |
| 825 | simple_list<item> m_overlay_list; // list of overlay items |
| 826 | simple_list<item> m_bezel_list; // list of bezel items |
| 827 | simple_list<item> m_cpanel_list; // list of marquee items |
| 828 | simple_list<item> m_marquee_list; // list of marquee items |
| 829 | }; |
| 830 | |
| 831 | |
| 832 | // ======================> layout_file |
| 833 | |
| 834 | // a layout_file consists of a list of elements and a list of views |
| 835 | class layout_file |
| 836 | { |
| 837 | friend class simple_list<layout_file>; |
| 838 | |
| 839 | public: |
| 840 | // construction/destruction |
| 841 | layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname); |
| 842 | virtual ~layout_file(); |
| 843 | |
| 844 | // getters |
| 845 | layout_file *next() const { return m_next; } |
| 846 | layout_element *first_element() const { return m_elemlist.first(); } |
| 847 | layout_view *first_view() const { return m_viewlist.first(); } |
| 848 | |
| 849 | private: |
| 850 | // internal state |
| 851 | layout_file * m_next; // pointer to the next file in the list |
| 852 | simple_list<layout_element> m_elemlist; // list of shared layout elements |
| 853 | simple_list<layout_view> m_viewlist; // list of views |
| 854 | }; |
| 855 | |
| 573 | 856 | // ======================> render_target |
| 574 | 857 | |
| 575 | 858 | // a render_target describes a surface that is being rendered to |
| r250125 | r250126 | |
| 780 | 1063 | simple_list<render_container> m_screen_container_list; // list of containers for the screen |
| 781 | 1064 | }; |
| 782 | 1065 | |
| 783 | | |
| 784 | 1066 | #endif // __RENDER_H__ |
trunk/src/emu/rendlay.h
| r250125 | r250126 | |
| 11 | 11 | #ifndef __RENDLAY_H__ |
| 12 | 12 | #define __RENDLAY_H__ |
| 13 | 13 | |
| 14 | | #include "render.h" |
| 15 | | |
| 16 | | |
| 17 | 14 | //************************************************************************** |
| 18 | | // CONSTANTS |
| 19 | | //************************************************************************** |
| 20 | | |
| 21 | | enum item_layer |
| 22 | | { |
| 23 | | ITEM_LAYER_FIRST = 0, |
| 24 | | ITEM_LAYER_BACKDROP = ITEM_LAYER_FIRST, |
| 25 | | ITEM_LAYER_SCREEN, |
| 26 | | ITEM_LAYER_OVERLAY, |
| 27 | | ITEM_LAYER_BEZEL, |
| 28 | | ITEM_LAYER_CPANEL, |
| 29 | | ITEM_LAYER_MARQUEE, |
| 30 | | ITEM_LAYER_MAX |
| 31 | | }; |
| 32 | | DECLARE_ENUM_OPERATORS(item_layer) |
| 33 | | |
| 34 | | |
| 35 | | |
| 36 | | //************************************************************************** |
| 37 | | // TYPE DEFINITIONS |
| 38 | | //************************************************************************** |
| 39 | | |
| 40 | | |
| 41 | | // ======================> layout_element |
| 42 | | |
| 43 | | // a layout_element is a single named element, which may have multiple components |
| 44 | | class layout_element |
| 45 | | { |
| 46 | | friend class simple_list<layout_element>; |
| 47 | | |
| 48 | | public: |
| 49 | | // construction/destruction |
| 50 | | layout_element(running_machine &machine, xml_data_node &elemnode, const char *dirname); |
| 51 | | virtual ~layout_element(); |
| 52 | | |
| 53 | | // getters |
| 54 | | layout_element *next() const { return m_next; } |
| 55 | | const char *name() const { return m_name.c_str(); } |
| 56 | | running_machine &machine() const { return m_machine; } |
| 57 | | int default_state() const { return m_defstate; } |
| 58 | | int maxstate() const { return m_maxstate; } |
| 59 | | render_texture *state_texture(int state); |
| 60 | | |
| 61 | | private: |
| 62 | | // a component represents an image, rectangle, or disk in an element |
| 63 | | class component |
| 64 | | { |
| 65 | | friend class layout_element; |
| 66 | | friend class simple_list<component>; |
| 67 | | |
| 68 | | public: |
| 69 | | // construction/destruction |
| 70 | | component(running_machine &machine, xml_data_node &compnode, const char *dirname); |
| 71 | | ~component(); |
| 72 | | |
| 73 | | // getters |
| 74 | | component *next() const { return m_next; } |
| 75 | | const render_bounds &bounds() const { return m_bounds; } |
| 76 | | |
| 77 | | // operations |
| 78 | | void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 79 | | |
| 80 | | private: |
| 81 | | // component types |
| 82 | | enum component_type |
| 83 | | { |
| 84 | | CTYPE_INVALID = 0, |
| 85 | | CTYPE_IMAGE, |
| 86 | | CTYPE_RECT, |
| 87 | | CTYPE_DISK, |
| 88 | | CTYPE_TEXT, |
| 89 | | CTYPE_LED7SEG, |
| 90 | | CTYPE_LED8SEG_GTS1, |
| 91 | | CTYPE_LED14SEG, |
| 92 | | CTYPE_LED16SEG, |
| 93 | | CTYPE_LED14SEGSC, |
| 94 | | CTYPE_LED16SEGSC, |
| 95 | | CTYPE_DOTMATRIX, |
| 96 | | CTYPE_DOTMATRIX5DOT, |
| 97 | | CTYPE_DOTMATRIXDOT, |
| 98 | | CTYPE_SIMPLECOUNTER, |
| 99 | | CTYPE_REEL, |
| 100 | | CTYPE_MAX |
| 101 | | }; |
| 102 | | |
| 103 | | // helpers |
| 104 | | void draw_rect(bitmap_argb32 &dest, const rectangle &bounds); |
| 105 | | void draw_disk(bitmap_argb32 &dest, const rectangle &bounds); |
| 106 | | void draw_text(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds); |
| 107 | | void draw_simplecounter(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 108 | | void draw_reel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 109 | | void draw_beltreel(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state); |
| 110 | | void load_bitmap(); |
| 111 | | void load_reel_bitmap(int number); |
| 112 | | void draw_led7seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 113 | | void draw_led8seg_gts1(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 114 | | void draw_led14seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 115 | | void draw_led14segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 116 | | void draw_led16seg(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 117 | | void draw_led16segsc(bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 118 | | void draw_dotmatrix(int dots,bitmap_argb32 &dest, const rectangle &bounds, int pattern); |
| 119 | | void draw_segment_horizontal_caps(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, int caps, rgb_t color); |
| 120 | | void draw_segment_horizontal(bitmap_argb32 &dest, int minx, int maxx, int midy, int width, rgb_t color); |
| 121 | | void draw_segment_vertical_caps(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, int caps, rgb_t color); |
| 122 | | void draw_segment_vertical(bitmap_argb32 &dest, int miny, int maxy, int midx, int width, rgb_t color); |
| 123 | | void draw_segment_diagonal_1(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); |
| 124 | | void draw_segment_diagonal_2(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); |
| 125 | | void draw_segment_decimal(bitmap_argb32 &dest, int midx, int midy, int width, rgb_t color); |
| 126 | | void draw_segment_comma(bitmap_argb32 &dest, int minx, int maxx, int miny, int maxy, int width, rgb_t color); |
| 127 | | void apply_skew(bitmap_argb32 &dest, int skewwidth); |
| 128 | | |
| 129 | | #define MAX_BITMAPS 32 |
| 130 | | |
| 131 | | // internal state |
| 132 | | component * m_next; // link to next component |
| 133 | | component_type m_type; // type of component |
| 134 | | int m_state; // state where this component is visible (-1 means all states) |
| 135 | | render_bounds m_bounds; // bounds of the element |
| 136 | | render_color m_color; // color of the element |
| 137 | | std::string m_string; // string for text components |
| 138 | | int m_digits; // number of digits for simple counters |
| 139 | | int m_textalign; // text alignment to box |
| 140 | | bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images |
| 141 | | std::string m_dirname; // directory name of image file (for lazy loading) |
| 142 | | auto_pointer<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files |
| 143 | | std::string m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) |
| 144 | | std::string m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) |
| 145 | | bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present? |
| 146 | | |
| 147 | | // stuff for fruit machine reels |
| 148 | | // basically made up of multiple text strings / gfx |
| 149 | | int m_numstops; |
| 150 | | std::string m_stopnames[MAX_BITMAPS]; |
| 151 | | int m_stateoffset; |
| 152 | | int m_reelreversed; |
| 153 | | int m_numsymbolsvisible; |
| 154 | | int m_beltreel; |
| 155 | | }; |
| 156 | | |
| 157 | | // a texture encapsulates a texture for a given element in a given state |
| 158 | | class texture |
| 159 | | { |
| 160 | | public: |
| 161 | | texture(); |
| 162 | | ~texture(); |
| 163 | | |
| 164 | | layout_element * m_element; // pointer back to the element |
| 165 | | render_texture * m_texture; // texture for this state |
| 166 | | int m_state; // associated state number |
| 167 | | }; |
| 168 | | |
| 169 | | // internal helpers |
| 170 | | static void element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); |
| 171 | | |
| 172 | | // internal state |
| 173 | | layout_element * m_next; // link to next element |
| 174 | | running_machine & m_machine; // reference to the owning machine |
| 175 | | std::string m_name; // name of this element |
| 176 | | simple_list<component> m_complist; // list of components |
| 177 | | int m_defstate; // default state of this element |
| 178 | | int m_maxstate; // maximum state value for all components |
| 179 | | std::vector<texture> m_elemtex; // array of element textures used for managing the scaled bitmaps |
| 180 | | }; |
| 181 | | |
| 182 | | |
| 183 | | // ======================> layout_view |
| 184 | | |
| 185 | | // a layout_view encapsulates a named list of items |
| 186 | | class layout_view |
| 187 | | { |
| 188 | | friend class simple_list<layout_view>; |
| 189 | | |
| 190 | | public: |
| 191 | | // an item is a single backdrop, screen, overlay, bezel, cpanel, or marquee item |
| 192 | | class item |
| 193 | | { |
| 194 | | friend class layout_view; |
| 195 | | friend class simple_list<item>; |
| 196 | | |
| 197 | | public: |
| 198 | | // construction/destruction |
| 199 | | item(running_machine &machine, xml_data_node &itemnode, simple_list<layout_element> &elemlist); |
| 200 | | virtual ~item(); |
| 201 | | |
| 202 | | // getters |
| 203 | | item *next() const { return m_next; } |
| 204 | | layout_element *element() const { return m_element; } |
| 205 | | screen_device *screen() { return m_screen; } |
| 206 | | const render_bounds &bounds() const { return m_bounds; } |
| 207 | | const render_color &color() const { return m_color; } |
| 208 | | int orientation() const { return m_orientation; } |
| 209 | | render_container *screen_container(running_machine &machine) const; |
| 210 | | bool has_input() const { return !m_input_tag.empty(); } |
| 211 | | ioport_port *input_tag_and_mask(ioport_value &mask) const { mask = m_input_mask; return m_input_port; }; |
| 212 | | |
| 213 | | // fetch state based on configured source |
| 214 | | int state() const; |
| 215 | | |
| 216 | | // resolve tags, if any |
| 217 | | void resolve_tags(); |
| 218 | | |
| 219 | | private: |
| 220 | | // internal state |
| 221 | | item * m_next; // link to next item |
| 222 | | layout_element * m_element; // pointer to the associated element (non-screens only) |
| 223 | | std::string m_output_name; // name of this item |
| 224 | | std::string m_input_tag; // input tag of this item |
| 225 | | ioport_port * m_input_port; // input port of this item |
| 226 | | ioport_value m_input_mask; // input mask of this item |
| 227 | | screen_device * m_screen; // pointer to screen |
| 228 | | int m_orientation; // orientation of this item |
| 229 | | render_bounds m_bounds; // bounds of the item |
| 230 | | render_bounds m_rawbounds; // raw (original) bounds of the item |
| 231 | | render_color m_color; // color of the item |
| 232 | | }; |
| 233 | | |
| 234 | | // construction/destruction |
| 235 | | layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist); |
| 236 | | virtual ~layout_view(); |
| 237 | | |
| 238 | | // getters |
| 239 | | layout_view *next() const { return m_next; } |
| 240 | | item *first_item(item_layer layer) const; |
| 241 | | const char *name() const { return m_name.c_str(); } |
| 242 | | const render_bounds &bounds() const { return m_bounds; } |
| 243 | | const render_bounds &screen_bounds() const { return m_scrbounds; } |
| 244 | | const render_screen_list &screens() const { return m_screens; } |
| 245 | | bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; } |
| 246 | | |
| 247 | | // |
| 248 | | bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); } |
| 249 | | float effective_aspect(render_layer_config config) const { return (config.zoom_to_screen() && m_screens.count() != 0) ? m_scraspect : m_aspect; } |
| 250 | | |
| 251 | | // operations |
| 252 | | void recompute(render_layer_config layerconfig); |
| 253 | | |
| 254 | | // resolve tags, if any |
| 255 | | void resolve_tags(); |
| 256 | | |
| 257 | | private: |
| 258 | | // internal state |
| 259 | | layout_view * m_next; // pointer to next layout in the list |
| 260 | | std::string m_name; // name of the layout |
| 261 | | float m_aspect; // X/Y of the layout |
| 262 | | float m_scraspect; // X/Y of the screen areas |
| 263 | | render_screen_list m_screens; // list of active screens |
| 264 | | render_bounds m_bounds; // computed bounds of the view |
| 265 | | render_bounds m_scrbounds; // computed bounds of the screens within the view |
| 266 | | render_bounds m_expbounds; // explicit bounds of the view |
| 267 | | bool m_layenabled[ITEM_LAYER_MAX]; // is this layer enabled? |
| 268 | | simple_list<item> m_backdrop_list; // list of backdrop items |
| 269 | | simple_list<item> m_screen_list; // list of screen items |
| 270 | | simple_list<item> m_overlay_list; // list of overlay items |
| 271 | | simple_list<item> m_bezel_list; // list of bezel items |
| 272 | | simple_list<item> m_cpanel_list; // list of marquee items |
| 273 | | simple_list<item> m_marquee_list; // list of marquee items |
| 274 | | }; |
| 275 | | |
| 276 | | |
| 277 | | // ======================> layout_file |
| 278 | | |
| 279 | | // a layout_file consists of a list of elements and a list of views |
| 280 | | class layout_file |
| 281 | | { |
| 282 | | friend class simple_list<layout_file>; |
| 283 | | |
| 284 | | public: |
| 285 | | // construction/destruction |
| 286 | | layout_file(running_machine &machine, xml_data_node &rootnode, const char *dirname); |
| 287 | | virtual ~layout_file(); |
| 288 | | |
| 289 | | // getters |
| 290 | | layout_file *next() const { return m_next; } |
| 291 | | layout_element *first_element() const { return m_elemlist.first(); } |
| 292 | | layout_view *first_view() const { return m_viewlist.first(); } |
| 293 | | |
| 294 | | private: |
| 295 | | // internal state |
| 296 | | layout_file * m_next; // pointer to the next file in the list |
| 297 | | simple_list<layout_element> m_elemlist; // list of shared layout elements |
| 298 | | simple_list<layout_view> m_viewlist; // list of views |
| 299 | | }; |
| 300 | | |
| 301 | | |
| 302 | | |
| 303 | | //************************************************************************** |
| 304 | 15 | // GLOBAL VARIABLES |
| 305 | 16 | //************************************************************************** |
| 306 | 17 | |
| r250125 | r250126 | |
| 326 | 37 | extern const char layout_lcd[]; // generic 1:1 lcd screen layout |
| 327 | 38 | extern const char layout_lcd_rot[]; // same, for use with ROT90 or ROT270 |
| 328 | 39 | |
| 40 | |
| 329 | 41 | #endif // __RENDLAY_H__ |