-
Notifications
You must be signed in to change notification settings - Fork 0
Render Engine
While input is cool and all, output is also a very necessary thing to like, anything. EmojIDE accomplishes this by a separate 'rendering engine', that all othe parts of the IDE delagate tasks to. It works by running a constant 1 second loop, each time getting the last thing off of a queue of tasks. These tasks either modify or edit messages, or are breakpoints (Mentioned later on). After getting the next entry, if anything else in the queue is refercing to the same message, the latest one is taken and all similar tasks are removed.
Breakpoints are just runnable actions that can be queued, that are executed once everything in the current render queue have been processed. These do not follow the standard 1 second loops, and are executed both before and after the processing of the current entry. Multiple breakpoints can be executed as well. These are used for things like queuing a set of actioonactions and a breakpoint, and then locking the current thread, with the breakpoint unlocking it.
The render engine is so slow because of Discord's rate limits. I've tried and thought of a bunch of different ways of going about this, and this seems like the best. For more reference, the code of the render engine is here: RenderEngine.java with Javadocs being here: RenderEngine.
The IDE can output its display to multiple different formats. It's also very easy to implement your own, due to the expandability of the IDE. The following are the implementations of the Displayer the IDE uses. Note that these do not affect any of the elements rendered, they just affect how they are rendered.
The CachedDisplayer (source) is the default displayer. This simply queues changed necessary lines in the rendered 2D Emoji array and queues them to the Render Engine.
The MockupImageDisplayer (source) renders the image files of each emoji to an image, and outputs them to a file called mockup.png. The image is then sent into the IDE's discord channel instead of outputting any emojis. This is used for fairly quick prototyping, and easy sharing of the mockup. An example of an output image of this Displayer is:

The MockupWebpageDisplayer (source) is the displayer for the most integrated-feeling rapid prototyping. Opening the mockup-display.html file locally will give a page looking identical to Discord's, and upon starting the bot, the emojis will reload automatiucally when it re-renders something. This has no rendered output of any kind to actual Discord, but can be very helpful. An example of what this local file looks like is:
