Skip to content

Commit 631a1cf

Browse files
committed
fixed bugs
1 parent 7c60672 commit 631a1cf

7 files changed

Lines changed: 81 additions & 104 deletions

File tree

downloads/cmake_setup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
.shot-placeholder { background: #f7f7f7; border: 1px dashed #ccc; border-radius: 8px; aspect-ratio: 16/9; max-width: 560px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #999; font-size: 12.5px; text-align: center; padding: 1rem; margin: 0.5rem 0 1.5rem; }
5050
.shot-placeholder .shot-filename { font-family: "SF Mono","Fira Code",monospace; font-weight: 700; margin-bottom: 0.35rem; color: #777; }
51-
.shot-img { width: 100%; max-width: 560px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
51+
.shot-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
5252
.shot-img[hidden] { display: none; }
5353

5454
footer { border-top: 1px solid #e0e0e0; padding: 2rem; text-align: center; font-size: 13px; color: #888; }

downloads/dragdrop_setup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
.shot-placeholder { background: #f7f7f7; border: 1px dashed #ccc; border-radius: 8px; aspect-ratio: 16/9; max-width: 560px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #999; font-size: 12.5px; text-align: center; padding: 1rem; margin: 0.5rem 0 1.5rem; }
5151
.shot-placeholder .shot-filename { font-family: "SF Mono","Fira Code",monospace; font-weight: 700; margin-bottom: 0.35rem; color: #777; }
52-
.shot-img { width: 100%; max-width: 560px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
52+
.shot-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
5353
.shot-img[hidden] { display: none; }
5454

5555
footer { border-top: 1px solid #e0e0e0; padding: 2rem; text-align: center; font-size: 13px; color: #888; }

downloads/index.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
.dl-btn-primary:hover { background: #d4a300; }
7171
.dl-btn-secondary { background: #f0f0f0; color: #444; border: 1px solid #e0e0e0; }
7272
.dl-btn-secondary:hover { background: #e6e6e6; }
73+
.dl-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
74+
.dl-howto { font-size: 13px; color: #777; border-bottom: 1px solid #ccc; padding-bottom: 1px; }
75+
.dl-howto:hover { color: #111; border-bottom-color: #111; }
7376

7477
.vscode-note { border-top: 1px solid #e0e0e0; padding-top: 1.75rem; margin-top: 1rem; }
7578
.vscode-note p { margin-bottom: 0.5rem; }
@@ -129,12 +132,18 @@ <h2>Download the header library</h2>
129132
<div class="download-card">
130133
<h3>Drag-and-Drop</h3>
131134
<p>For projects with no existing build system, or compiling a single file directly with <code>g++</code>.</p>
132-
<a class="dl-btn dl-btn-primary" href="https://github.com/processing-cpp/processing.cpp/releases/latest/download/processing-cpp-dragdrop.zip">Download</a>
135+
<div class="dl-actions">
136+
<a class="dl-btn dl-btn-primary" href="https://github.com/processing-cpp/processing.cpp/releases/latest/download/processing-cpp-dragdrop.zip">Download</a>
137+
<a class="dl-howto" href="/downloads/dragdrop-setup.html">How to use?</a>
138+
</div>
133139
</div>
134140
<div class="download-card">
135141
<h3>CMake</h3>
136142
<p>For projects that already use CMake, or want the engine wired up as a library target.</p>
137-
<a class="dl-btn dl-btn-secondary" href="https://github.com/processing-cpp/processing.cpp/releases/latest/download/processing-cpp-cmake.zip">Download</a>
143+
<div class="dl-actions">
144+
<a class="dl-btn dl-btn-secondary" href="https://github.com/processing-cpp/processing.cpp/releases/latest/download/processing-cpp-cmake.zip">Download</a>
145+
<a class="dl-howto" href="/downloads/cmake-setup.html">How to use?</a>
146+
</div>
138147
</div>
139148
</div>
140149

downloads/vscode.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
border: 1px dashed #ccc;
5151
border-radius: 8px;
5252
aspect-ratio: 16/9;
53-
max-width: 560px;
5453
display: flex;
5554
flex-direction: column;
5655
align-items: center;
@@ -62,7 +61,7 @@
6261
margin: 0.5rem 0 1.5rem;
6362
}
6463
.shot-placeholder .shot-filename { font-family: "SF Mono","Fira Code",monospace; font-weight: 700; margin-bottom: 0.35rem; color: #777; }
65-
.shot-img { width: 100%; max-width: 560px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
64+
.shot-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
6665
.shot-img[hidden] { display: none; }
6766

6867
footer { border-top: 1px solid #e0e0e0; padding: 2rem; text-align: center; font-size: 13px; color: #888; }

gettingstarted/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
border: 1px dashed #ccc;
7474
border-radius: 8px;
7575
aspect-ratio: 16/9;
76-
max-width: 560px;
7776
display: flex;
7877
flex-direction: column;
7978
align-items: center;
@@ -85,7 +84,7 @@
8584
margin: 0.5rem 0 1.5rem;
8685
}
8786
.shot-placeholder .shot-filename { font-family: "SF Mono","Fira Code",monospace; font-weight: 700; margin-bottom: 0.35rem; color: #777; }
88-
.shot-img { width: 100%; max-width: 560px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
87+
.shot-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; margin: 0.5rem 0 1.5rem; }
8988
.shot-img[hidden] { display: none; }
9089

9190
.next-steps { border-top: 1px solid #e0e0e0; margin-top: 3rem; padding-top: 2rem; display: flex; gap: 1.5rem; flex-wrap: wrap; }

index.html

Lines changed: 58 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
/* Hero */
5252
.main {
5353
height: calc(100vh - 60px);
54+
min-height: 500px;
55+
max-height: 720px;
5456
display: flex;
5557
align-items: center;
5658
padding: 0 5rem;
@@ -106,8 +108,9 @@
106108
border-radius: 8px;
107109
overflow: hidden;
108110
}
109-
.example-card { background: #fff; overflow: hidden; }
110-
.example-canvas { width: 100%; aspect-ratio: 1; background: #000; display: block; }
111+
.example-card { background: #fff; overflow: hidden; display: block; text-decoration: none; color: inherit; }
112+
.example-card:hover .example-info h3 { color: #e8b400; }
113+
.example-canvas { width: 100%; aspect-ratio: 16/9; background: #000; display: block; }
111114
.example-info { padding: 1rem 1.25rem; border-top: 1px solid #e0e0e0; }
112115
.example-info h3 { font-size: 14px; font-weight: 500; margin-bottom: 0.2rem; }
113116
.example-info p { font-size: 12px; color: #888; }
@@ -191,96 +194,18 @@ <h1>C++ Mode for<br><span class="proc">Processing</span></h1>
191194
<div class="examples-section">
192195
<h2>Examples</h2>
193196
<div class="examples-grid">
194-
<div class="example-card">
195-
<iframe class="example-canvas" id="c1" width="300" height="300" style="width:100%;aspect-ratio:1;border:none;display:block;background:#000;" scrolling="no"></iframe><script>(function(){const iframe=document.getElementById('c1');const doc=iframe.contentDocument||iframe.contentWindow.document;doc.open();doc.write(`<!DOCTYPE html><html><head><style>*{margin:0;padding:0;}body{overflow:hidden;}</style><script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"><\/script></head><body><script>let y = 180;
196-
197-
function setup() {
198-
createCanvas(300,300);
199-
stroke(255);
200-
noLoop();
201-
}
202-
203-
function draw() {
204-
background(0);
205-
206-
line(0, y, width, y);
207-
208-
y = y - 1;
209-
210-
if (y < 0) {
211-
y = height;
212-
}
213-
}<\/script></body></html>`);doc.close();})();</script>
214-
<div class="example-info"><h3>No Loop</h3><p>Structure example</p></div>
215-
</div>
216-
<div class="example-card">
217-
<iframe class="example-canvas" id="c2" width="300" height="300" style="width:100%;aspect-ratio:1;border:none;display:block;background:#000;" scrolling="no"></iframe><script>(function(){const iframe=document.getElementById('c2');const doc=iframe.contentDocument||iframe.contentWindow.document;doc.open();doc.write(`<!DOCTYPE html><html><head><style>*{margin:0;padding:0;}body{overflow:hidden;}</style><script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"><\/script></head><body><script>function setup() {
218-
createCanvas(300,300, WEBGL);
219-
noStroke();
220-
}
221-
222-
function draw() {
223-
defineLights();
224-
background(0);
225-
226-
for (let x = 0; x <= width; x += 60) {
227-
for (let y = 0; y <= height; y += 60) {
228-
push();
229-
230-
translate(
231-
x - width / 2,
232-
y - height / 2,
233-
0
234-
);
235-
236-
rotateY(map(mouseX, 0, width, 0, PI));
237-
rotateX(map(mouseY, 0, height, 0, PI));
238-
239-
box(90);
240-
241-
pop();
242-
}
243-
}
244-
}
245-
246-
function defineLights() {
247-
pointLight(150, 100, 0, 200, -150, 0);
248-
249-
directionalLight(0, 102, 255, 1, 0, 0);
250-
251-
spotLight(
252-
255,
253-
255,
254-
109,
255-
0,
256-
40,
257-
200,
258-
0,
259-
-0.5,
260-
-0.5,
261-
PI / 2,
262-
2
263-
);
264-
}<\/script></body></html>`);doc.close();})();</script>
265-
<div class="example-info"><h3>Mixture Grid</h3><p>Lights example</p></div>
266-
</div>
267-
<div class="example-card">
268-
<iframe class="example-canvas" id="c3" width="300" height="300" style="width:100%;aspect-ratio:1;border:none;display:block;background:#000;" scrolling="no"></iframe><script>(function(){const iframe=document.getElementById('c3');const doc=iframe.contentDocument||iframe.contentWindow.document;doc.open();doc.write(`<!DOCTYPE html><html><head><style>*{margin:0;padding:0;}body{overflow:hidden;}</style><script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"><\/script></head><body><script>function setup() {
269-
createCanvas(300,300);
270-
background(0);
271-
strokeWeight(20);
272-
frameRate(2);
273-
}
274-
275-
function draw() {
276-
for (let i = 0; i < width; i++) {
277-
let r = random(255);
278-
stroke(r);
279-
line(i, 0, i, height);
280-
}
281-
}<\/script></body></html>`);doc.close();})();</script>
282-
<div class="example-info"><h3>Random</h3><p>Math example</p></div>
283-
</div>
197+
<a class="example-card" href="/examples" id="card1">
198+
<canvas class="example-canvas" id="c1"></canvas>
199+
<div class="example-info"><h3>Bouncing ball</h3><p>Basic animation with collision detection</p></div>
200+
</a>
201+
<a class="example-card" href="/examples" id="card2">
202+
<canvas class="example-canvas" id="c2"></canvas>
203+
<div class="example-info"><h3>Particle system</h3><p>STL vectors with per-particle physics</p></div>
204+
</a>
205+
<a class="example-card" href="/examples" id="card3">
206+
<canvas class="example-canvas" id="c3"></canvas>
207+
<div class="example-info"><h3>Perlin noise</h3><p>Flow field using noise()</p></div>
208+
</a>
284209
</div>
285210
<div class="examples-footer">
286211
<a href="/examples">View all examples →</a>
@@ -314,6 +239,47 @@ <h3>New to C++ Mode?</h3>
314239
<p>Processing for C++</p>
315240
</footer>
316241

242+
<script>
243+
new p5(function(p) {
244+
let x, y, vx, vy;
245+
p.setup = function() { p.createCanvas(300,300,document.getElementById('c1')); x=150;y=150;vx=2.5;vy=1.8;p.noStroke(); };
246+
p.draw = function() {
247+
p.background(10); p.fill(50,50,200); p.ellipse(x,y,36,36);
248+
x+=vx; y+=vy;
249+
if(x<18||x>282) vx*=-1;
250+
if(y<18||y>282) vy*=-1;
251+
};
252+
});
253+
new p5(function(p) {
254+
let parts=[];
255+
p.setup = function() { p.createCanvas(300,300,document.getElementById('c2')); p.noStroke(); };
256+
p.draw = function() {
257+
p.background(10,10,20,25);
258+
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});
259+
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);}
260+
parts=parts.filter(pt=>pt.life>0);
261+
};
262+
});
263+
new p5(function(p) {
264+
let t=0;
265+
p.setup = function() { p.createCanvas(300,300,document.getElementById('c3')); p.stroke(232,103,58,60); p.strokeWeight(1); p.noFill(); };
266+
p.draw = function() {
267+
p.background(10,10,20,15);
268+
for(let i=0;i<5;i++){
269+
let x=p.random(p.width),y=p.random(p.height);
270+
for(let j=0;j<20;j++){
271+
let angle=p.noise(x*0.005,y*0.005,t)*p.TWO_PI*2;
272+
let vx=p.cos(angle)*2,vy=p.sin(angle)*2;
273+
p.stroke(232,103+j*3,58,80);
274+
p.line(x,y,x+vx*3,y+vy*3);
275+
x+=vx;y+=vy;
276+
if(x<0||x>p.width||y<0||y>p.height) break;
277+
}
278+
}
279+
t+=0.003;
280+
};
281+
});
282+
</script>
317283
<script src="./assets/nav.js"></script>
318284
</body>
319285
</html>

regen.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,17 @@ def update_homepage_examples(repo_root, sections):
461461
for canvas_id, ex in zip(canvas_ids, picks):
462462
iframe_html = make_preview_iframe(ex["js"], canvas_id, HOMEPAGE_PREVIEW_SIZE)
463463
card_re = re.compile(
464-
rf'<canvas class="example-canvas" id="{canvas_id}"></canvas>\s*'
465-
rf'<div class="example-info"><h3>[^<]*</h3><p>[^<]*</p></div>'
464+
rf'<a class="example-card"[^>]*id="card{canvas_ids.index(canvas_id)+1}"[^>]*>\\s*'
465+
rf'<canvas class="example-canvas" id="{canvas_id}"></canvas>\\s*'
466+
rf'<div class="example-info"><h3>[^<]*</h3><p>[^<]*</p></div>\\s*'
467+
rf'</a>'
466468
)
467469
replacement = (
468-
f"{iframe_html}\n"
470+
f'<a class="example-card" href="/examples/{ex["slug"]}.html" id="card{canvas_ids.index(canvas_id)+1}">\n'
471+
f" {iframe_html}\n"
469472
f' <div class="example-info"><h3>{ex["name"]}</h3>'
470-
f'<p>{ex["category"]} example</p></div>'
473+
f'<p>{ex["category"]} example</p></div>\n'
474+
f' </a>'
471475
)
472476
html, n = card_re.subn(replacement, html, count=1)
473477
if n == 0:

0 commit comments

Comments
 (0)