Skip to content

Instantly share code, notes, and snippets.

@ed95
Created March 29, 2018 16:33
Show Gist options
  • Save ed95/77a81d780f125217d5c3e856c4c4be04 to your computer and use it in GitHub Desktop.
Save ed95/77a81d780f125217d5c3e856c4c4be04 to your computer and use it in GitHub Desktop.
A simple JUCE app using emojis
/*******************************************************************************
The block below describes the properties of this PIP. A PIP is a short snippet
of code that can be read by the Projucer and used to generate a JUCE project.
BEGIN_JUCE_PIP_METADATA
name: EmojiJUCE
vendor: JUCE
website: http://juce.com
dependencies: juce_core, juce_data_structures, juce_events, juce_graphics, juce_gui_basics
exporters: xcode_mac, xcode_iphone
type: Component
mainClass: EmojiJUCE
END_JUCE_PIP_METADATA
*******************************************************************************/
#pragma once
#include "../JuceLibraryCode/JuceHeader.h"
#include "juce_EmojiDefines.h"
//==============================================================================
πŸ— πŸŠπŸ”Œ : 🐡 πŸ”Œ
{
πŸŠπŸ”Œ (πŸ“* πŸ‘»πŸŠπŸ“, πŸ‘†<float> πŸ‘»πŸŠπŸ‘†)
: πŸŠπŸ“ (πŸ‘»πŸŠπŸ“),
πŸŠπŸ‘† (πŸ‘»πŸŠπŸ‘†)
{
πŸ‘‰πŸ“ (40, 40);
πŸŠπŸ‘‰();
}
bool πŸŠπŸ‘‰()
{
πŸŠπŸ‘† += 🍊🏎;
🍊🏎.y += 0.1f;
πŸ‘‰Β·πŸ‘† ((int) πŸŠπŸ‘†.x,
(int) πŸŠπŸ‘†.y);
if (🎁* πŸ‘¦ = πŸ‘ˆπŸ‘¦())
πŸ‘ˆ πŸ“ˆ (πŸŠπŸ‘†.x, (float) πŸ‘¦->πŸ‘ˆπŸ“πŸ‘ˆ()) && πŸŠπŸ‘†.y < (float) πŸ‘¦->πŸ‘ˆπŸ“πŸ‘†();
πŸ‘ˆ πŸŠπŸ‘†.y < 400.0f && πŸŠπŸ‘†.x >= -10.0f;
}
πŸ•³ πŸ‘¨β€πŸŽ¨ (πŸ‘Ύ& πŸ“„) πŸ‘ΆπŸ‘¦
{
πŸŠπŸ“->πŸ–πŸ“ (πŸ“„, πŸ‘ˆπŸ πŸ“().toFloat(), RectanglePlacement::Β·, 1.0f);
}
//==============================================================================
πŸ“* πŸŠπŸ“;
πŸ‘†<float> πŸŠπŸ‘†,
🍊🏎 { 🎲().nextFloat() * 4.0f - 2.0f,
🎲().nextFloat() * -6.0f - 2.0f };
//==============================================================================
🚿🚨 (πŸŠπŸ”Œ)
};
//==============================================================================
πŸŽ“ EmojiJUCE : 🐡 πŸ”Œ,
πŸ™ˆ πŸ•°
{
🐡:
//==============================================================================
EmojiJUCE()
{
πŸ‘‰πŸ“ (600, 400);
πŸ› ();
πŸŽ¬πŸ•° (60);
}
~EmojiJUCE()
{
}
//==============================================================================
πŸ•³ πŸ‘¨β€πŸŽ¨ (πŸ‘Ύ& πŸ“„) πŸ‘ΆπŸ‘¦
{
πŸ“„.πŸŒ• (πŸ‘ˆπŸ–Ό().πŸ‘€πŸŽ¨ (ResizableWindow::backgroundColourId));
πŸ“„.πŸ‘‰πŸ–‹ (πŸ–‹ (16.0f));
πŸ“„.πŸ‘‰πŸŽ¨ (🎨 (255, 255, 255));
πŸ‘ˆπŸ§  🀑;
if (Base64::convertFromBase64 (🀑, "QXByaWwgRm9vbCdzIQ=="))
πŸ“„.πŸ–πŸ“œ (🀑.toString(), πŸ‘ˆπŸ πŸ“(), Justification::Β·);
}
πŸ•³ πŸ“() πŸ‘ΆπŸ‘¦
{
}
πŸ™ˆ:
//==============================================================================
πŸ•³ πŸ•°πŸ“ž() πŸ‘ΆπŸ‘¦
{
πŸ’« (int i = 🍊🍊.πŸ“(); --i >= 0;)
if (! 🍊🍊.πŸ“€ (i)->πŸŠπŸ‘‰())
🍊🍊.πŸ”₯ (i);
if (🎲().nextInt (100) < 4)
πŸ‘€πŸ”Œ (🍊🍊.πŸ“₯ (πŸ‘Ά πŸŠπŸ”Œ (🍊, πŸ‘ˆπŸ“().πŸ‘ˆΒ·().toFloat())));
}
πŸ‘πŸšŒ<πŸŠπŸ”Œ> 🍊🍊;
πŸ”­πŸ‘†<πŸ“> 🍊;
//==============================================================================
πŸ•³ πŸ› ()
{
const char* πŸ‘»πŸŠ = R"JUCELogo(
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><g mask="url(#mask-2)" fill="#B144C8">
<path d="M23.7 49.5C14 49.5 6 41.5 6 31.7 6 22 14 14 23.7 14 33.5 14 41.5 22 41.5 31.7 41.5
41.5 33.5 49.5 23.7 49.5ZM23.7 15.2C14.6 15.2 7.2 22.6 7.2 31.7 7.2 40.9 14.6 48.3
23.7 48.3 32.9 48.3 40.3 40.9 40.3 31.7 40.3 22.6 32.9 15.2 23.7 15.2Z"/>
<path d="M37.7 31.1C38 31.1 38.3 31 38.5 30.8 38.8 30.6 38.9 30.3 38.8 29.9 38.5 27.2 37.4
24.5 35.7 22.3 35.5 22 35.2 21.9 34.8 21.9 34.6 21.9 34.3 22 34.1 22.2L25.5 30.8C25.4
30.9 25.5 31.1 25.7 31.1L37.7 31.1Z"/>
<path d="M34.8 41.6L34.8 41.6C35.2 41.6 35.5 41.4 35.7 41.1 37.4 38.9 38.5 36.3 38.8 33.5 38.9
33.2 38.8 32.9 38.5 32.6 38.3 32.4 38 32.3 37.7 32.3L25.7 32.3C25.5 32.3 25.4 32.5 25.5
32.7L34.1 41.2C34.3 41.4 34.6 41.6 34.8 41.6"/>
<path d="M12.6 21.9C12.3 21.9 12 22 11.8 22.3 10 24.5 9 27.2 8.6 29.9 8.6 30.3 8.7 30.6 8.9
30.8 9.1 31 9.4 31.1 9.7 31.1L21.8 31.1C22 31.1 22.1 30.9 21.9 30.8L13.4 22.2C13.2
22 12.9 21.9 12.6 21.9"/>
<path d="M21.8 32.3L9.7 32.3C9.4 32.3 9.1 32.4 8.9 32.6 8.7 32.9 8.6 33.2 8.6 33.5 9 36.3 10
38.9 11.8 41.1 12 41.4 12.3 41.6 12.6 41.6 12.9 41.6 13.2 41.4 13.4 41.2L13.4 41.2 21.9
32.7C22.1 32.5 22 32.3 21.8 32.3"/>
<path d="M23.1 17.7C23.1 17.4 23 17.1 22.8 16.9 22.6 16.7 22.3 16.6 21.9 16.6 19.2 17 16.5 18 14.3
19.8 14 20 13.9 20.3 13.9 20.6 13.9 20.9 14 21.2 14.2 21.4L22.8 29.9C22.9 30.1 23.1 30 23.1
29.8L23.1 17.7Z"/>
<path d="M33.6 20.6L33.6 20.6C33.6 20.3 33.4 20 33.1 19.8 30.9 18 28.3 17 25.5 16.6 25.2 16.6 24.9
16.7 24.6 16.9 24.4 17.1 24.3 17.4 24.3 17.7L24.3 29.8C24.3 30 24.5 30.1 24.7 29.9L33.2
21.4C33.4 21.2 33.6 20.9 33.6 20.6"/>
<path d="M13.9 42.8C13.9 43.2 14 43.5 14.3 43.7 16.5 45.4 19.2 46.5 21.9 46.8 22.3 46.9 22.6 46.8
22.8 46.5 23 46.3 23.1 46 23.1 45.7L23.1 33.7C23.1 33.5 22.9 33.4 22.8 33.5L14.2 42.1C14
42.3 13.9 42.6 13.9 42.8"/>
<path d="M24.3 45.7C24.3 46 24.4 46.3 24.6 46.5 24.9 46.8 25.2 46.9 25.5 46.8 28.3 46.5 30.9
45.4 33.1 43.7 33.4 43.5 33.6 43.2 33.6 42.8 33.6 42.6 33.4 42.3 33.2 42.1L24.7 33.5C24.5
33.4 24.3 33.5 24.3 33.7L24.3 45.7Z"/>
</g>
</svg>
)JUCELogo";
πŸ”­πŸ‘†<🏷> πŸ–₯ (🏷🏷::πŸ‘“ (πŸ‘»πŸŠ));
🍊 = πŸ“::πŸ‘ΆπŸ–₯ (*πŸ–₯);
πŸš” (🍊 != πŸ•³πŸ‘ˆ);
}
//==============================================================================
🚿🚨 (EmojiJUCE)
};
@NBorthwick
Copy link

πŸ’― πŸ₯‡ πŸ‘

@yfede
Copy link

yfede commented Apr 1, 2018

for some reason, github doesn't allow me to comment with emojis, ROFL!

@JoKontage
Copy link

Clearly the future of programming! πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯
Looking forward to using my favorite function, β˜•.
Great job. πŸ‘ ❀️

@alexsandro-xpt
Copy link

Big idea!!!! it's awesome!!!

@mathias-dietrich
Copy link

Some serious progress!!

will start working on Emo I, an emoji synthesize based Synth!

Save the day
m

@gehringc
Copy link

gehringc commented Apr 1, 2018

I think this is a good idea for reducing code size, but mostly only for project specific uses. Is changing over the entire library and standard library keyboards going to increase readability? Maybe over time this will grow easier but it essentially requires the coder to learn a new language (linguistically speaking) and introduces a steeper learning curve to new, non-emoji fluent programmers wanting to get started with juce. I hope at the very least the header will be configured so that the emoji defines can be optional (which i’m guessing it will)

@dblais01
Copy link

I can't wait to use this in my next interview white-board session! Thanks!!! 🎲

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment