MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / keyboard

Function keyboard

cpp/4_CUDA_Libraries/randomFog/randomFog.cpp:388–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386void glutClose() { cleanup(EXIT_SUCCESS); }
387
388void keyboard(unsigned char key, int x, int y)
389{
390 switch (key) {
391 // Select shape
392 case 's':
393 case 'S':
394 g_currentShape = Sphere;
395 createSphere();
396 display();
397 break;
398
399 case 'e':
400 case 'E':
401 g_currentShape = SphericalShell;
402 createSphere();
403 display();
404 break;
405
406 case 'b':
407 case 'B':
408 g_currentShape = Cube;
409 createCube();
410 display();
411 break;
412
413 case 'p':
414 case 'P':
415 g_currentShape = Plane;
416 createPlane();
417 display();
418 break;
419
420 // Rotation
421 case 'a':
422 case 'A':
423 g_bAutoRotate = !g_bAutoRotate;
424 break;
425
426 case 'i':
427 case 'I':
428 g_xRotated -= 1.0f;
429
430 if (g_xRotated <= 0.0f) {
431 g_xRotated += 360.0f;
432 }
433
434 display();
435 break;
436
437 case ',':
438 g_xRotated += 1.0f;
439
440 if (g_xRotated >= 360.0f) {
441 g_xRotated -= 360.0f;
442 }
443
444 display();
445 break;

Callers

nothing calls this directly

Calls 10

createSphereFunction · 0.85
createCubeFunction · 0.85
createPlaneFunction · 0.85
reCreateFunction · 0.85
selectRngMethod · 0.80
resetSeedMethod · 0.80
incrementDimensionsMethod · 0.80
resetDimensionsMethod · 0.80
displayFunction · 0.70
reshapeFunction · 0.70

Tested by

no test coverage detected