Rearrange graphics projects into subdirectory

This commit is contained in:
Shaun Reed 2021-05-29 15:08:39 -04:00
parent 255d7efe9f
commit c2300d7121
20 changed files with 42 additions and 146 deletions

View File

@ -20,5 +20,5 @@ project(
add_subdirectory(algorithms) add_subdirectory(algorithms)
add_subdirectory(cmake) add_subdirectory(cmake)
add_subdirectory(datastructs) add_subdirectory(datastructs)
add_subdirectory(graphics)
add_subdirectory(patterns) add_subdirectory(patterns)
add_subdirectory(sdl-cmake)

View File

@ -5,11 +5,9 @@ shaunrd0/klips/cpp/
├── algorithms # Examples of various algorithms written in C++ ├── algorithms # Examples of various algorithms written in C++
├── cmake # Example of using cmake to build and organize larger projects ├── cmake # Example of using cmake to build and organize larger projects
├── datastructs # Collection of useful datastructures written in C++ ├── datastructs # Collection of useful datastructures written in C++
├── opengl # Barebones opengl application written in C++ built with gcc ├── graphics # Examples of graphics projects written in C++
├── patterns # Examples of various design patterns written in C++ ├── patterns # Examples of various design patterns written in C++
├── README.md └── README.md
├── sdl-cmake # Barebones sdl application written in C++ built with cmake
└── sdl # Barebones sdl application written in C++ built with gcc
``` ```
This directory contains a `CMakeLists.txt`, which can be selected to open as a This directory contains a `CMakeLists.txt`, which can be selected to open as a

View File

@ -13,7 +13,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_executable(radix-sort "radix-sort.cpp") add_executable(radix-sort "radix-sort.cpp")
add_library(lib-counting "lib-counting.cpp") add_library(lib-radix-counting "lib-counting.cpp")
add_library(lib-radix "lib-radix.cpp") add_library(lib-radix "lib-radix.cpp")
target_link_libraries(radix-sort lib-radix lib-counting) target_link_libraries(radix-sort lib-radix lib-radix-counting)

View File

@ -0,0 +1,21 @@
###############################################################################
## Author: Shaun Reed ##
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
## About: A root project for practicing C++ ##
## This project can be built to debug and run all nested projects ##
## Or, any subdirectory with a project() statement can be selected ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
##############################################################################
#
cmake_minimum_required(VERSION 3.15)
project(
#[[NAME]] Graphics
VERSION 1.0
DESCRIPTION "A root project for practicing graphics programming in C++"
LANGUAGES CXX
)
add_subdirectory(opengl-cmake)
add_subdirectory(sdl-cmake)

12
cpp/graphics/README.md Normal file
View File

@ -0,0 +1,12 @@
# Graphics
Example graphics programming projects written in C++
```
klips/cpp/graphics
.
├── opengl # Barebones opengl application written in C++ built with gcc
├── opengl-cmake# Barebones opengl application written in C++ built with cmake
├── sdl-cmake # Barebones sdl application written in C++ built with cmake
└── sdl # Barebones sdl application written in C++ built with gcc
```

View File

@ -13,6 +13,7 @@
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include <cstdio> #include <cstdio>
#include <iostream>
//Screen constants //Screen constants
const int SCREEN_WIDTH = 640; const int SCREEN_WIDTH = 640;
@ -25,6 +26,9 @@ const int COLOR_MODE_MULTI = 1;
int main( int argc, char* args[] ) int main( int argc, char* args[] )
{ {
std::cout << "Press Q to change color mode, E to adjust zoom\n";
//Initialize FreeGLUT //Initialize FreeGLUT
glutInit( &argc, args ); glutInit( &argc, args );

View File

@ -1,27 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test-gl",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

View File

@ -1,30 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "cpp build active file",
"command": "/usr/bin/g++",
"args": [
"${file}",
"-lGL",
"-lGLU",
"-lglut",
"-o",
"${fileDirname}/build/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@ -1,27 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/inherited",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

View File

@ -1,29 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/inherited",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

View File

@ -1,26 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "cpp build active file",
"command": "g++",
"args": [
"${workspaceFolder}/inherited.cpp",
"-lSDL2",
"-o",
"${workspaceFolder}/build/inherited",
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}