Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Development/talagan_EmojImGui.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--[[
@description EmojImGui : An Emoji / Icon library for ReaImGui
@version 0.3.0
@author Ben 'Talagan' Babut
@license MIT
@donation https://www.paypal.com/donate/?business=3YEZMY9D6U8NC&no_recurring=1&currency_code=EUR
@links
Forum Thread https://forum.cockos.com/showthread.php?t=TODO
@changelog
- Initial version
@metapackage
@provides
[nomain] talagan_EmojImGui/assets/build/OpenMoji-color-glyf_colr_0-patched.ttf
[nomain] talagan_EmojImGui/assets/build/openmoji-spec.json
[nomain] talagan_EmojImGui/assets/build/openmoji-spec.lua
[nomain] talagan_EmojImGui/assets/build/TweMoji-color-glyf_colr_0-patched.ttf
[nomain] talagan_EmojImGui/assets/build/twemoji-spec.json
[nomain] talagan_EmojImGui/assets/build/twemoji-spec.lua
[nomain] talagan_EmojImGui/emojimgui/**/*.lua
[nomain] talagan_EmojImGui/emojimgui.lua
[main] talagan_EmojImGui/actions/talagan_EmojImGui Demo.lua > .
@about
# Purpose

This library targets developers who want to add emoji/icon support to their Reaper applications in lua.

It offers two emoji fonts (OpenMoji and TweMoji) that have been patched to work with ReaImGui / Freetype, as well specification files describing their structure.

The library comes as an API that allows to load these fonts, as well as a ready-to-use icon picker.

OpenMoji is an open source font released under the CC BY-SA 4.0 license, and written by many teachers and students from the HfG Schwäbisch Gmünd university (https://openmoji.org). Thanks to their hard work !

TweMoji is an open source font released under the CC-BY 4.0 license, originally written by twitter and maintained here (https://github.com/jdecked/twemoji).

--]]
88 changes: 88 additions & 0 deletions Development/talagan_EmojImGui/actions/talagan_EmojImGui Demo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
-- @noindex
-- @author Ben 'Talagan' Babut
-- @license MIT
-- @description This file is part of EmojImGui

-- Load IconPicker class
local ACTION = debug.getinfo(1,"S").source
local ACTION_DIR = (ACTION:match[[^@?(.*[\/])[^\/]-$]]):gsub("talagan_EmojImGui/actions/$","/") -- Works both in dev and prod

package.path = package.path .. ";" .. reaper.ImGui_GetBuiltinPath() .. '/?.lua'
package.path = package.path .. ";" .. ACTION_DIR .. "talagan_EmojImgui/?.lua"

local ImGui = require "emojimgui/ext/imgui"
local EmojImGui = require "emojimgui"

local use_profiler = false

if use_profiler then
local profiler = dofile(reaper.GetResourcePath() .. '/Scripts/ReaTeam Scripts/Development/cfillion_Lua profiler.lua')

reaper.defer = profiler.defer
profiler.attachToWorld() -- after all functions have been defined
profiler.run()
end

-- Set the path to EmojImGui assets. Here it is done because the demo needs to work in dev directly from the git repo
-- But for any dev using the library, the path should already be set internally by the lib and this call is not needed.
EmojImGui.Asset.SetPath(ACTION_DIR .. "talagan_EmojImgui/assets/build")

-- Create ImGui context
local ctx = ImGui.CreateContext("EmojImGui Picker Demo")

-- Demo state
local selected_icon = nil
local picker = nil

local function loop()
local picked_icon = nil

if picker then
picked_icon = picker:draw(ctx)

-- If an icon was selected
if picked_icon then
selected_icon = picked_icon
picker = nil
end
end

local visible, open = ImGui.Begin(ctx, "EmojImGui Demo", true, ImGui.WindowFlags_AlwaysAutoResize | ImGui.WindowFlags_NoDocking)
if visible then
ImGui.Text(ctx, "Selected icon" .. (selected_icon and " (Click to pick again)" or ""))
ImGui.Separator(ctx)

if selected_icon then
local icon = selected_icon
ImGui.PushFont(ctx, EmojImGui.Asset.Font(ctx, icon.font_name), 40)
ImGui.Text(ctx, selected_icon.utf8)
ImGui.PopFont(ctx)

ImGui.SameLine(ctx)

ImGui.Text(ctx, string.format("ID : %s\nLabel: " .. icon.label .. "\nMapped at : U+%X", icon.id, icon.codepoint) )
else
ImGui.Text(ctx, "None (click to pick)")
end

if not picker and ImGui.IsWindowHovered(ctx) and ImGui.IsMouseClicked(ctx, ImGui.MouseButton_Left) then
picker = EmojImGui.Picker:new()
--EmojImGui.Asset.CharInfo("TweMoji", "1F3F4-E0067-E0062-E0077-E006C-E0073-E007F")
end

if picker and not picker.open then
-- Garbage collect the current picker if closed by user
picker = nil
end

ImGui.End(ctx)
end

if not open then
return
end

reaper.defer(loop)
end

reaper.defer(loop)
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Development/talagan_EmojImGui/assets/build/openmoji-spec.lua

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Development/talagan_EmojImGui/assets/build/twemoji-spec.lua

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Development/talagan_EmojImGui/emojimgui.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- @noindex
-- @author Ben 'Talagan' Babut
-- @license MIT
-- @description This file is part of EmojImGui

-- This file is main API entry point and should be the only one to require

local Asset = require "emojimgui/modules/assets"
local Picker = require "emojimgui/widgets/picker"

return {
Asset = Asset,
Picker = Picker
}
8 changes: 8 additions & 0 deletions Development/talagan_EmojImGui/emojimgui/ext/imgui.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- @noindex
-- @author Ben 'Talagan' Babut
-- @license MIT
-- @description This file is part of EmojImGui

local ImGui = require 'imgui' '0.10.0'

return ImGui
Loading