Open bazz1tv opened 8 years ago
Ryphecha> bazzy: You'll want to create a surface that's nominal_width x nominal_height, or some multiple of that, and (ab)use mouse_scale_x, mouse_scale_y, mouse_offs_x, and mouse_offs_y for coordinate mapping but not all emulated systems set the mouse scaling variables
<zeromus> you know what would be fun is if you could draw graffiti on a netplay session
This is a contribution that should be made to the latest official mednafen release (not this repo) - but it's here for posterity.
Impl Notes
looking at the following functions to assist this impl:
MDFNI_NetplayText
SendCommand(MDFNNPCMD_TEXT, len, text);
This is the command that is used to send chat messages back and forth between the clients.
These commands are received in netplay.cpp
case MDFNNPCMD_TEXT
, and add some processing to them.... The draw commands should be prefixed with a non-printable ASCII byte or short sequence to decipher them from normal chat commands and/or allow room for other commands to be reserved. draw commands must not be printed to screen.Sending commands will be done from
input.cpp
void Input_Event(const SDL_Event *event)
I believe.One could have a layer specifically for the graffiti that would be drawn last upon other layers that mednafen draws to.
Respond to mouse click and drag events such that pixels are plotted to the screen with random colors (see https://github.com/amatus/sdl-examples/blob/master/paint/paint.c)
Unhandled Conflicts
Later Features
/grafitti [on/off]
- a command to turn the mode on and off.. this basically enables the SDL surfaces and mouse event handling / msg sending.Commands
/g
toggles on/off (impl'd)/g [on/off]
(impl'd)/g clear
(impl'd LOCALLY ONLY)/g color [random | red | green | blue]
/g color #000fff
/g text wow!
/g textsize 12
Other Todo