|
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | 4 | <meta charset="UTF-8"> |
| 5 | + <link rel="preconnect" href="https://fonts.googleapis.com"> |
| 6 | + <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap"> |
5 | 7 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
6 | 8 | <title>Processing for C++</title> |
7 | 9 | <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"></script> |
|
178 | 180 | <div class="page-body"> |
179 | 181 | <div class="main"> |
180 | 182 | <div class="left" style="display:flex;flex-direction:column;gap:1rem;min-width:0;flex:1;"> |
181 | | - <p style="font-size:1rem;color:#444;line-height:1.7;max-width:480px;font-family:'SpaceGrotesk',sans-serif;"> |
182 | | - C++ Mode is a plugin for <a href="https://processing.org" style="color:#111;border-bottom:1px solid #ccc;">Processing</a> that lets you write native C++ sketches using the Processing API. Get the performance of compiled C++ with the simplicity of Processing's creative coding environment. |
| 183 | + <h1 style="font-family:'Space Grotesk',sans-serif;font-size:2rem;font-weight:600;color:#111;line-height:1.2;margin-bottom:0.75rem;">Welcome to<br>Processing for C++</h1> |
| 184 | + <p style="font-size:0.95rem;color:#555;line-height:1.8;max-width:440px;font-family:'Space Grotesk',sans-serif;"> |
| 185 | + If you love Processing but wish you could squeeze more performance out of your sketches — this is for you. C++ Mode is a plugin that lets you write Processing sketches in native C++, keeping the API you know while getting the speed of compiled code. Great for simulations, generative art, and anything that needs to run fast. |
183 | 186 | </p> |
184 | 187 | <div class="hero-actions"> |
185 | 188 | <a class="hero-link" href="/reference">Reference</a> |
@@ -593,31 +596,40 @@ <h3>New to C++ Mode?</h3> |
593 | 596 | heroEditor.setSize('100%', '300px'); |
594 | 597 |
|
595 | 598 | let heroEditorOpen = false; |
| 599 | +let heroEditorMoved = false; |
| 600 | + |
596 | 601 | function toggleHeroEditor() { |
597 | 602 | heroEditorOpen = !heroEditorOpen; |
598 | | - const panel = document.getElementById('hero-editor-panel'); |
| 603 | + const overlay = document.getElementById('hero-editor-overlay'); |
599 | 604 | const arrow = document.getElementById('hero-arrow-svg'); |
600 | 605 | const runBtn = document.getElementById('hero-sketch-run-btn'); |
| 606 | + |
601 | 607 | if (heroEditorOpen) { |
602 | | - panel.style.maxHeight = '400px'; |
603 | | - panel.style.opacity = '1'; |
| 608 | + overlay.style.display = 'flex'; |
604 | 609 | arrow.style.transform = 'rotate(180deg)'; |
605 | 610 | runBtn.style.display = 'block'; |
606 | | - setTimeout(() => heroEditor.refresh(), 420); |
| 611 | + // Move CodeMirror into the overlay on first open |
| 612 | + if (!heroEditorMoved) { |
| 613 | + document.getElementById('hero-cm-wrap').appendChild(heroEditor.getWrapperElement()); |
| 614 | + heroEditorMoved = true; |
| 615 | + } |
| 616 | + heroEditor.setSize('100%', '100%'); |
| 617 | + setTimeout(() => heroEditor.refresh(), 50); |
| 618 | + document.body.style.overflow = 'hidden'; |
607 | 619 | } else { |
608 | | - panel.style.maxHeight = '0'; |
609 | | - panel.style.opacity = '0'; |
| 620 | + overlay.style.display = 'none'; |
610 | 621 | arrow.style.transform = ''; |
611 | 622 | runBtn.style.display = 'none'; |
| 623 | + document.body.style.overflow = ''; |
612 | 624 | } |
613 | 625 | } |
614 | 626 |
|
615 | 627 | function heroLaunch(html) { |
616 | | - const area = document.getElementById('hero-preview'); |
| 628 | + const area = document.getElementById('hero-preview-overlay'); |
617 | 629 | const old = area.querySelector('iframe'); |
618 | 630 | const iframe = document.createElement('iframe'); |
619 | 631 | iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin'); |
620 | | - iframe.style.cssText = 'position:absolute;top:0;left:0;width:600px;height:700px;border:none;transform-origin:top left;transform:scale(0.533);'; |
| 632 | + iframe.style.cssText = 'position:absolute;top:0;left:0;width:100%;height:100%;border:none;'; |
621 | 633 | iframe.src = URL.createObjectURL(new Blob([html], {type:'text/html'})); |
622 | 634 | if (old) { area.replaceChild(iframe, old); try{URL.revokeObjectURL(old.src);}catch(e){} } |
623 | 635 | else area.appendChild(iframe); |
|
0 commit comments