I am finally getting around to creating an mvs module. Usage will be to have artwork like a neo geo multislot, and navigate all slots. When user is on the last slot, or first slot, and continues in that direction, all slots will shift over.
Example: Numbers are list entry. O is a selected game.
1 2 3 4
O x x x
->
1 2 3 4
x O x x
->
1 2 3 4
x x O x
->
1 2 3 4
x x x O
->
2 3 4 5
x x x O
<-
2 3 4 5
x x O x
The issue I am having thus far is that when I send mvs.slot_artwork[0].file_name in the log it yields nothing, yet all other slots yield a correct file name. It doesn’t make any sense to me. Can anyone spot the issue?
Here’s my code so far.
class MVS {
artwork_label = "";
num_slots = 0;
opacity = 0;
artwork_parent = null;
slot_artwork = [];
selected_slot = 0;
constructor(a="marquee", n=4, o=25, ap=::fe) {
artwork_label = a;
num_slots = n;
opacity = o;
artwork_parent = ap;
for (local i=0; i<num_slots; i++) {
slot_artwork.push(artwork_parent.add_artwork(artwork_label, -1, -1, 1, 1));
}
set_slots();
}
function set_slots() {
for (local i=0; i<num_slots; i++) {
slot_artwork[i].index_offset = -(selected_slot - i);
}
}
}
// --------------------
// Load Modules
// --------------------
if (fe.load_module("Debug")) log <- Log();
fe.load_module("shader");
fe.load_module("helpers");
fe.load_module("fade");
fe.load_module("mvs");
// --------------------
// Layout User Options
// --------------------
class UserConfig {
}
local config = fe.get_config();
// --------------------
// Layout Constants
// --------------------
local flw = fe.layout.width;
local flh = fe.layout.height;
// --------------------
// Colors
// --------------------
local colors = {
black = { r = 0, g = 0, b = 0 },
white = { r = 255, g = 255, b = 255 },
grey = { r = 120, g = 120, b = 120 },
}
// --------------------
// Settings
// --------------------
local settings = {
snap = {
x = 0,
y = 0,
width = flw,
height = flh,
},
}
// --------------------
// Magic Functions
// --------------------
// --------------------
// Layout
// --------------------
local snap = FadeArt("snap", -1, -1, 1, 1);
setProperties(snap, settings.snap);
local mvs = MVS();
try { log.send(mvs.slot_artwork[0].file_name + " " + mvs.slot_artwork[0].index_offset); } catch(e) {}
try { log.send(mvs.slot_artwork[1].file_name + " " + mvs.slot_artwork[1].index_offset); } catch(e) {}
try { log.send(mvs.slot_artwork[2].file_name + " " + mvs.slot_artwork[2].index_offset); } catch(e) {}
try { log.send(mvs.slot_artwork[3].file_name + " " + mvs.slot_artwork[3].index_offset); } catch(e) {}
// --------------------
// Enable Shaders
// --------------------
Keils-iMac:MacOS keiljr$ /Applications/Attract.app/Contents/MacOS/attract
Starting Attract-Mode v2.2.0-3 (OSX)
Config: /Users/keiljr/.attract/attract.cfg
*** Initializing display: 'Neo Geo'
- Loaded master romlist 'mame' in 1 ms (147 entries kept, 10 discarded)
- Constructed 10 filters in 0 ms (1470 comparisons)
Fontconfig error: Cannot load default config file
- Debug message: 0
- Debug message: /Applications/mame0182b_macOS/marquees/roboarmy.png 1
- Debug message: /Applications/mame0182b_macOS/marquees/svc.png 2
- Debug message: /Applications/mame0182b_macOS/marquees/samsho.png 3
- Loaded layout: /Users/keiljr/.attract/layouts/mvscomplete/ (layout.nut)