2024-01-20 12:05:26 +00:00
|
|
|
/*
|
|
|
|
* mii_mui.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2023 Michel Pollet <buserror@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
/*
|
|
|
|
This tries to contains a structure that is the MUI interface over the MII
|
|
|
|
video, but without any attachment to x11 or opengl. Basically hopefully
|
2024-02-18 10:32:33 +00:00
|
|
|
segregating the relevant logic without tying it to a specific windowing
|
|
|
|
system.
|
2024-01-20 12:05:26 +00:00
|
|
|
Hopefully with a bit more work this OUGHT to allow Windows/macOS port
|
|
|
|
with a native frontend.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "mii.h"
|
|
|
|
#include "mui.h"
|
|
|
|
#include "mii_mui_settings.h"
|
2024-02-18 10:32:33 +00:00
|
|
|
#include "mii_floppy.h"
|
2024-01-20 12:05:26 +00:00
|
|
|
|
|
|
|
enum mii_mui_transition_e {
|
|
|
|
MII_MUI_TRANSITION_NONE,
|
|
|
|
MII_MUI_TRANSITION_HIDE_UI,
|
|
|
|
MII_MUI_TRANSITION_SHOW_UI,
|
|
|
|
};
|
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
#define MII_PIXEL_LAYERS 9
|
2024-02-18 10:32:33 +00:00
|
|
|
|
2024-03-13 08:45:11 +00:00
|
|
|
DECLARE_C_ARRAY(float, float_array, 16);
|
|
|
|
IMPLEMENT_C_ARRAY(float_array);
|
|
|
|
|
|
|
|
typedef struct mii_vtx_t {
|
|
|
|
unsigned int kind; // TRIANGLES, QUADS, etc
|
|
|
|
float_array_t pos;
|
|
|
|
float_array_t tex;
|
|
|
|
} mii_vtx_t;
|
|
|
|
|
2024-01-20 12:05:26 +00:00
|
|
|
typedef struct mii_mui_t {
|
|
|
|
mui_t mui; // mui interface
|
|
|
|
mii_t mii; // apple II emulator
|
2024-02-18 10:32:33 +00:00
|
|
|
c2_pt_t window_size;
|
|
|
|
long last_button_click;
|
|
|
|
struct {
|
|
|
|
int ungrab, grab, grabbed, down;
|
|
|
|
c2_pt_t pos;
|
|
|
|
} mouse;
|
|
|
|
mui_event_t key;
|
2024-01-20 12:05:26 +00:00
|
|
|
|
2024-02-18 10:32:33 +00:00
|
|
|
c2_rect_t video_frame; // current video frame
|
2024-05-13 15:31:58 +00:00
|
|
|
uint32_t video_drawn_seed;
|
2024-02-18 10:32:33 +00:00
|
|
|
float mui_alpha;
|
2024-01-20 12:05:26 +00:00
|
|
|
bool mui_visible;
|
2024-02-18 10:32:33 +00:00
|
|
|
void * transision_state;
|
|
|
|
struct {
|
|
|
|
uint8_t state;
|
|
|
|
mui_time_t start, end;
|
|
|
|
c2_rect_t from, to;
|
|
|
|
} transition;
|
|
|
|
unsigned int tex_id[MII_PIXEL_LAYERS];
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
mui_drawable_t mii;
|
|
|
|
mui_drawable_t mui;
|
|
|
|
struct {
|
|
|
|
mui_drawable_t bits;
|
|
|
|
mui_drawable_t hm_read;
|
|
|
|
mui_drawable_t hm_write;
|
|
|
|
} floppy[2];
|
2024-05-13 15:31:58 +00:00
|
|
|
// this is debug only!
|
|
|
|
mui_drawable_t video_heapmap;
|
2024-02-18 10:32:33 +00:00
|
|
|
};
|
|
|
|
mui_drawable_t v[MII_PIXEL_LAYERS];
|
|
|
|
} pixels;
|
|
|
|
struct {
|
|
|
|
mii_floppy_t * floppy;
|
|
|
|
uint32_t seed_load;
|
|
|
|
float max_width;
|
2024-03-13 08:45:11 +00:00
|
|
|
/* technically speaking we'd only need one set of vertices, but hey */
|
|
|
|
mii_vtx_t vtx;
|
2024-02-18 10:32:33 +00:00
|
|
|
} floppy[2];
|
2024-03-13 08:45:11 +00:00
|
|
|
float_array_t floppy_base;
|
2024-01-20 12:05:26 +00:00
|
|
|
|
|
|
|
mii_machine_config_t config;
|
|
|
|
mii_loadbin_conf_t loadbin_conf;
|
|
|
|
|
|
|
|
mii_config_file_t cf;
|
|
|
|
} mii_mui_t;
|
|
|
|
|
2024-02-18 10:32:33 +00:00
|
|
|
void
|
|
|
|
mii_mui_init(
|
|
|
|
mii_mui_t * ui,
|
|
|
|
c2_pt_t window_size);
|
2024-01-20 12:05:26 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
mii_mui_menus_init(
|
|
|
|
mii_mui_t * ui);
|
|
|
|
void
|
|
|
|
mii_mui_menu_slot_menu_update(
|
|
|
|
mii_mui_t * ui);
|
2024-02-18 10:32:33 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
mii_mui_update_mouse_card(
|
|
|
|
mii_mui_t * ui);
|
|
|
|
void
|
|
|
|
mii_mui_showhide_ui_machine(
|
|
|
|
mii_mui_t * ui );
|
|
|
|
c2_rect_t
|
|
|
|
mii_mui_get_video_position(
|
|
|
|
mii_mui_t * ui);
|
|
|
|
|
2024-01-20 12:05:26 +00:00
|
|
|
// slot can be <= 0 to open the machine dialog instead
|
|
|
|
void
|
|
|
|
mii_config_open_slots_dialog(
|
|
|
|
mii_mui_t * ui);
|
2024-05-13 15:31:58 +00:00
|
|
|
|
|
|
|
|