RetroCoreView: RetroGTK Reference Manual

## RetroCoreView RetroCoreView — A widget to handle a core's inputs and outputs |

## Functions

RetroCoreView * | retro_core_view_new ()
void | retro_core_view_set_core ()
void | retro_core_view_set_pixbuf ()
GdkPixbuf * | retro_core_view_get_pixbuf ()
void | retro_core_view_set_filter ()
void | retro_core_view_set_key_joypad_mapping ()
RetroKeyJoypadMapping * | retro_core_view_get_key_joypad_mapping ()
RetroController * | retro_core_view_as_controller ()
void | retro_core_view_set_as_default_controller ()
gint16 | retro_core_view_get_input_state ()
guint64 | retro_core_view_get_controller_capabilities ()
gboolean | retro_core_view_get_can_grab_pointer ()
void | retro_core_view_set_can_grab_pointer ()
gboolean | retro_core_view_get_snap_pointer_to_borders ()
void | retro_core_view_set_snap_pointer_to_borders ()

## Properties

gboolean | can-grab-pointer | Read / Write
gboolean | snap-pointer-to-borders | Read / Write

## Signals

void | controller-state-changed | Run Last

## Types and Values

#define | RETRO_TYPE_CORE_VIEW
| RetroCoreView

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBin
                        ╰── GtkEventBox
                            ╰── RetroCoreView

## Implemented Interfaces

RetroCoreView implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <retro-gtk/retro-gtk.h>

## Description

## Functions

### retro_core_view_new ()

    RetroCoreView *
    retro_core_view_new (void);

Creates a new RetroCoreView.

#### Returns

a new RetroCoreView.

[transfer full]

### retro_core_view_set_core ()

    void
    retro_core_view_set_core (RetroCoreView *self,
                              RetroCore *core);

Sets `core` as the RetroCore handled by `self` .

#### Parameters

self | a RetroCoreView |
core | a RetroCore, or `NULL`. | [nullable]

### retro_core_view_set_pixbuf ()

    void
    retro_core_view_set_pixbuf (RetroCoreView *self,
                                GdkPixbuf *pixbuf);

Sets `pixbuf` as the currently displayed video frame.

retro_pixbuf_set_aspect_ratio() can be used to specify the aspect ratio for the pixbuf. Otherwise the core's aspect ratio will be used.

#### Parameters

self | a RetroCoreView |
pixbuf | a GdkPixbuf |

### retro_core_view_get_pixbuf ()

    GdkPixbuf *
    retro_core_view_get_pixbuf (RetroCoreView *self);

Gets the currently displayed video frame.

#### Parameters

self | a RetroCoreView |

#### Returns

a GdkPixbuf.

[transfer none]

### retro_core_view_set_filter ()

    void
    retro_core_view_set_filter (RetroCoreView *self,
                                RetroVideoFilter filter);

Sets the video filter to use to render the core's video on `self` .

#### Parameters

self | a RetroCoreView |
filter | a RetroVideoFilter |

### retro_core_view_set_key_joypad_mapping ()

    void
    retro_core_view_set_key_joypad_mapping
                                   (RetroCoreView *self,
                                    RetroKeyJoypadMapping *mapping);

Sets the key joypad mapping on `self` . If given mapping is `NULL`, then set to an empty configuration.

#### Parameters

self | a RetroCoreView |
mapping | a RetroKeyJoypadMapping. | [nullable]

### retro_core_view_get_key_joypad_mapping ()

    RetroKeyJoypadMapping *
    retro_core_view_get_key_joypad_mapping
                                   (RetroCoreView *self);

Gets the currently set key joypad mapping.

#### Parameters

self | a RetroCoreView |

#### Returns

a RetroKeyJoypadMapping.

[transfer none]

### retro_core_view_as_controller ()

    RetroController *
    retro_core_view_as_controller (RetroCoreView *self,
                                   RetroControllerType controller_type);

Creates a new RetroController exposing `self` as the specified controller type. The valid controller types are RETRO_CONTROLLER_TYPE_JOYPAD, RETRO_CONTROLLER_TYPE_MOUSE, RETRO_CONTROLLER_TYPE_KEYBOARD and RETRO_CONTROLLER_TYPE_POINTER.

#### Parameters

self | a RetroCoreView |
controller_type | the controller type to expose `self` as |

#### Returns

a new RetroController.

[transfer full]

### retro_core_view_set_as_default_controller ()

    void
    retro_core_view_set_as_default_controller
                                   (RetroCoreView *self,
                                    RetroCore *core);

Sets the `self` as the default controllers of `core` .

#### Parameters

self | a RetroCoreView |
core | a RetroCore. | [nullable]

### retro_core_view_get_input_state ()

    gint16
    retro_core_view_get_input_state (RetroCoreView *self,
                                     RetroInput *input);

Gets the state of an input of `self` .

#### Parameters

self | a RetroCoreView |
input | a RetroInput to query `self` |

#### Returns

the input's state

### retro_core_view_get_controller_capabilities ()

    guint64
    retro_core_view_get_controller_capabilities
                                   (RetroCoreView *self);

Gets a flag representing the capabilities of `self` when exposed as a controller. See `retro_controller_get_capabilities()` for more information on the flag.

See `retro_core_view_as_controller()` to know the capabilities of RetroCoreView when exposed as a controller.

#### Parameters

self | a RetroCoreView |

#### Returns

the capabilities flag of `self` when exposed as a controller

### retro_core_view_get_can_grab_pointer ()

    gboolean
    retro_core_view_get_can_grab_pointer (RetroCoreView *self);

Gets whether the pointer should be grabbed when clicking on the view. This allows `self` to work as a RETRO_CONTROLLER_TYPE_MOUSE instead of a RETRO_CONTROLLER_TYPE_POINTER.

#### Parameters

self | a RetroCoreView |

#### Returns

whether the pointer should snap to the borders

### retro_core_view_set_can_grab_pointer ()

    void
    retro_core_view_set_can_grab_pointer (RetroCoreView *self,
                                          gboolean can_grab_pointer);

Sets whether the pointer should be grabbed when clicking on the view. This allows `self` to work as a RETRO_CONTROLLER_TYPE_MOUSE instead of a RETRO_CONTROLLER_TYPE_POINTER.

#### Parameters

self | a RetroCoreView |
can_grab_pointer | whether the pointer should be grabbed when clicking on the view |

### retro_core_view_get_snap_pointer_to_borders ()

    gboolean
    retro_core_view_get_snap_pointer_to_borders
                                   (RetroCoreView *self);

Gets whether the pointer should be considered to be at the border of the video display when it is outside of it. This is used when `self` is exposed as a RETRO_CONTROLLER_TYPE_POINTER.

#### Parameters

self | a RetroCoreView |

#### Returns

whether the pointer should snap to the borders

### retro_core_view_set_snap_pointer_to_borders ()

    void
    retro_core_view_set_snap_pointer_to_borders
                                   (RetroCoreView *self,
                                    gboolean snap_pointer_to_borders);

Sets whether the pointer should be considered to be at the border of the video display when it is outside of it. This is used when `self` is exposed as a RETRO_CONTROLLER_TYPE_POINTER.

#### Parameters

self | a RetroCoreView |
snap_pointer_to_borders | whether the pointer should snap to the borders |

## Types and Values

### RETRO_TYPE_CORE_VIEW

    #define RETRO_TYPE_CORE_VIEW (retro_core_view_get_type())

### RetroCoreView

    typedef struct _RetroCoreView RetroCoreView;

## Property Details

### The `“can-grab-pointer”` property

      “can-grab-pointer”         gboolean

Whether the pointer can be grabbed.

Owner: RetroCoreView

Flags: Read / Write

Default value: FALSE

### The `“snap-pointer-to-borders”` property

      “snap-pointer-to-borders”  gboolean

Wheter the pointer is considered to be on the border when it is out of the display.

Owner: RetroCoreView

Flags: Read / Write

Default value: FALSE

## Signal Details

### The `“controller-state-changed”` signal

    void
    user_function (RetroCoreView *self,
                   gpointer       user_data)

The ::controller-state-changed signal is emitted when a key is pressed or released, mouse pointer is moved, or a mouse button is pressed or released.

Applications should not connect to it.

#### Parameters

self | the RetroCoreView |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Stability Level: Private

## See Also

RetroCore, RetroVideoFilter