-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
266 lines (245 loc) · 10.9 KB
/
Copy pathindex.html
File metadata and controls
266 lines (245 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>C++ Mode for Processing</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #111; background: #fff; }
a { color: #111; text-decoration: none; }
nav {
border-bottom: 1px solid #e0e0e0;
padding: 0 2rem;
display: flex; align-items: center; justify-content: space-between;
height: 60px; position: sticky; top: 0; background: #fff; z-index: 100;
}
.nav-logo { display: flex; align-items: center; gap: 10px; color: #111; }
.nav-logo img { width: 28px; height: 28px; }
.nav-logo span { font-size: 15px; font-weight: 500; }
.hamburger { display: none; background: none; border: none; cursor: pointer; font-size: 22px; padding: 4px 8px; }
.search-wrap { position: relative; }
.search-wrap input {
border: 1px solid #ddd; border-radius: 6px;
padding: 6px 12px 6px 32px;
font-size: 13px; outline: none; width: 180px;
background: #f8f8f8; color: #111;
transition: border-color 0.2s, width 0.2s;
}
.search-wrap input:focus { border-color: #aaa; width: 220px; background: #fff; }
.search-wrap svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; stroke: #aaa; fill: none; pointer-events: none; }
.search-results {
position: absolute; top: calc(100% + 8px); right: 0;
background: #fff; border: 1px solid #e0e0e0;
border-radius: 8px; width: 280px;
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
display: none; z-index: 200; overflow: hidden;
}
.search-results.show { display: block; }
.search-result-item { padding: 10px 14px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f8f8f8; }
.search-result-item .tag { font-size: 11px; color: #aaa; margin-left: 6px; }
.search-empty { padding: 12px 14px; font-size: 13px; color: #aaa; }
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
width: 220px; min-width: 220px;
border-right: 1px solid #e0e0e0;
padding: 2rem 1.5rem;
display: flex; flex-direction: column; gap: 0.25rem;
position: sticky; top: 60px;
height: calc(100vh - 60px);
background: #fff;
}
.sidebar a { font-size: 14px; color: #555; padding: 0.4rem 0; display: block; }
.sidebar a:hover { color: #111; }
.page-body { flex: 1; }
.main {
height: calc(100vh - 60px);
display: flex; align-items: center;
padding: 0 5rem; gap: 4rem;
}
.left { flex: 1; }
.left h1 { font-size: 2.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 1.5rem; }
.left h1 .proc { font-family: "IBM Plex Sans", sans-serif; color: #0064ff; font-weight: 700; }
.left p { font-size: 1rem; color: #555; margin-bottom: 0; }
.left p a { color: #111; border-bottom: 1px solid #111; font-weight: 500; }
.right { flex: 1; display: flex; justify-content: flex-end; align-items: center; }
.right img { width: 340px; height: 340px; object-fit: contain; }
.scroll-hint { text-align: center; padding: 1rem 0; color: #ccc; font-size: 22px; }
.examples-section { max-width: 960px; margin: 0 auto; padding: 5rem 3rem; border-top: 1px solid #e0e0e0; }
.examples-section h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 2.5rem; }
.examples-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1px; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; }
.example-card { background: #fff; overflow: hidden; }
.example-canvas { width: 100%; aspect-ratio: 1; background: #000; display: block; }
.example-info { padding: 1rem 1.25rem; border-top: 1px solid #e0e0e0; }
.example-info h3 { font-size: 14px; font-weight: 500; margin-bottom: 0.2rem; }
.example-info p { font-size: 12px; color: #888; }
.examples-footer { padding: 3rem; text-align: center; }
.examples-footer a { font-size: 14px; color: #555; border-bottom: 1px solid #ddd; padding-bottom: 2px; }
.examples-footer a:hover { color: #111; border-color: #111; }
footer { border-top: 1px solid #e0e0e0; padding: 2rem; text-align: center; font-size: 13px; color: #888; }
@media (max-width: 768px) {
.hamburger { display: block; }
.sidebar {
position: fixed; top: 60px; left: -240px;
width: 240px; height: calc(100vh - 60px);
z-index: 200; transition: left 0.25s ease;
box-shadow: 2px 0 12px rgba(0,0,0,0.08);
}
.sidebar.open { left: 0; }
.main { flex-direction: column; padding: 3rem 2rem; height: auto; }
.right img { width: 200px; height: 200px; }
.search-wrap { display: none; }
}
</style>
</head>
<body>
<nav>
<div class="nav-logo">
<img src="assets/cpp-logo.png" alt="C++ Mode">
<span>C++ Mode</span>
</div>
<div style="display:flex;align-items:center;gap:1.5rem;">
<div class="search-wrap">
<svg viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
<input type="text" id="search-input" placeholder="Search..." autocomplete="off">
<div class="search-results" id="search-results"></div>
</div>
<button class="hamburger" onclick="document.getElementById('sidebar').classList.toggle('open')">☰</button>
</div>
</nav>
<div class="layout">
<div class="sidebar" id="sidebar">
<a href="/libraries">Libraries</a>
<a href="/reference">Reference</a>
<a href="/examples">Examples</a>
<a href="/about">About</a>
</div>
<div class="page-body">
<div class="main">
<div class="left">
<h1>C++ Mode for<br><span class="proc">Processing</span></h1>
<p>Explore the <a href="/reference">C++ Mode reference</a> for the full API.</p>
</div>
<div class="right">
<img src="assets/cpp-logo.png" alt="C++ Mode">
</div>
</div>
<div class="scroll-hint">↓</div>
<div class="examples-section">
<p style="font-size:0.95rem;color:#888;margin-bottom:0.5rem;">Explore the <a href="/reference" style="color:#111;border-bottom:1px solid #ddd;">C++ Mode reference</a> for the full API.</p>
<h2>Examples</h2>
<div class="examples-grid">
<div class="example-card">
<canvas class="example-canvas" id="c1"></canvas>
<div class="example-info"><h3>Bouncing ball</h3><p>Basic animation with collision detection</p></div>
</div>
<div class="example-card">
<canvas class="example-canvas" id="c2"></canvas>
<div class="example-info"><h3>Particle system</h3><p>STL vectors with per-particle physics</p></div>
</div>
<div class="example-card">
<canvas class="example-canvas" id="c3"></canvas>
<div class="example-info"><h3>Perlin noise</h3><p>Flow field using noise()</p></div>
</div>
</div>
<div class="examples-footer">
<a href="/examples">View all examples</a>
</div>
</div>
</div>
</div>
<footer><p>C++ Mode for Processing</p></footer>
<script>
const data = [
{ title: "Libraries", url: "/libraries", tag: "page" },
{ title: "Reference", url: "/reference", tag: "page" },
{ title: "Examples", url: "/examples", tag: "page" },
{ title: "About", url: "/about", tag: "page" },
{ title: "setup()", url: "/reference", tag: "reference" },
{ title: "draw()", url: "/reference", tag: "reference" },
{ title: "size()", url: "/reference", tag: "reference" },
{ title: "background()", url: "/reference", tag: "reference" },
{ title: "ellipse()", url: "/reference", tag: "reference" },
{ title: "rect()", url: "/reference", tag: "reference" },
{ title: "fill()", url: "/reference", tag: "reference" },
{ title: "stroke()", url: "/reference", tag: "reference" },
{ title: "mouseX", url: "/reference", tag: "reference" },
{ title: "mouseY", url: "/reference", tag: "reference" },
{ title: "std::vector", url: "/libraries", tag: "library" },
{ title: "std::map", url: "/libraries", tag: "library" },
{ title: "std::string", url: "/libraries", tag: "library" },
{ title: "std::thread", url: "/libraries", tag: "library" },
];
const input = document.getElementById("search-input");
const results = document.getElementById("search-results");
input.addEventListener("input", function() {
const q = this.value.trim().toLowerCase();
results.innerHTML = "";
if (!q) { results.classList.remove("show"); return; }
const matches = data.filter(d =>
d.title.toLowerCase().includes(q)
).slice(0, 8);
if (matches.length === 0) {
results.innerHTML = '<div class="search-empty">No results</div>';
} else {
matches.forEach(m => {
const div = document.createElement("div");
div.className = "search-result-item";
div.innerHTML = m.title + '<span class="tag">' + m.tag + '</span>';
div.onclick = () => { window.location = m.url; };
results.appendChild(div);
});
}
results.classList.add("show");
});
document.addEventListener("click", function(e) {
if (!e.target.closest(".search-wrap")) results.classList.remove("show");
});
new p5(function(p) {
let x, y, vx, vy;
p.setup = function() { p.createCanvas(300,300,p.document.getElementById('c1')); x=150;y=150;vx=2.5;vy=1.8;p.noStroke(); };
p.draw = function() {
p.background(10); p.fill(50,50,200); p.ellipse(x,y,36,36);
x+=vx; y+=vy;
if(x<18||x>282) vx*=-1;
if(y<18||y>282) vy*=-1;
};
});
new p5(function(p) {
let parts=[];
p.setup = function() { p.createCanvas(300,300,p.document.getElementById('c2')); p.noStroke(); };
p.draw = function() {
p.background(10,10,20,25);
if(p.frameCount%3===0) parts.push({x:p.random(p.width),y:p.height,vx:p.random(-1,1),vy:p.random(-4,-1),life:1.0});
for(let pt of parts){pt.x+=pt.vx;pt.y+=pt.vy;pt.vy+=0.05;pt.life-=0.008;p.fill(232,103,58,pt.life*255);p.ellipse(pt.x,pt.y,6,6);}
parts=parts.filter(pt=>pt.life>0);
};
});
new p5(function(p) {
let t=0;
p.setup = function() { p.createCanvas(300,300,p.document.getElementById('c3')); p.stroke(232,103,58,60); p.strokeWeight(1); p.noFill(); };
p.draw = function() {
p.background(10,10,20,15);
for(let i=0;i<5;i++){
let x=p.random(p.width),y=p.random(p.height);
for(let j=0;j<20;j++){
let angle=p.noise(x*0.005,y*0.005,t)*p.TWO_PI*2;
let vx=p.cos(angle)*2,vy=p.sin(angle)*2;
p.stroke(232,103+j*3,58,80);
p.line(x,y,x+vx*3,y+vy*3);
x+=vx;y+=vy;
if(x<0||x>p.width||y<0||y>p.height) break;
}
}
t+=0.003;
};
});
</script>
</body>
</html>