Skip to content

Commit

Permalink
feat: CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioRodrigues10 committed Feb 15, 2024
1 parent 2ab5fd8 commit f1d4338
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 30 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate code format with clang-format
on: [push, pull_request]
jobs:
formatting-check:
runs-on: ubuntu-latest
strategy:
matrix:
path:
- check: "*"
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: "15"
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
fallback-style: "Google"
14 changes: 8 additions & 6 deletions include/figure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

typedef std::vector<std::tuple<std::string, std::string>> Point;

class Figure{
public:
Figure();
void exportFile(std::string filename);
private:
std::vector<Point> points;
class Figure
{
public:
Figure();
void exportFile(std::string filename);

private:
std::vector<Point> points;
};
Empty file removed include/test.hpp
Empty file.
29 changes: 13 additions & 16 deletions src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
#define _USE_MATH_DEFINES
#include <math.h>


void changeSize(int w, int h)
{
// Prevent a divide by zero, when window is too short
// (you cant make a window with zero width).
// (you cant make a window with zero width).
if (h == 0)
h = 1;
// compute window's aspect ratio
Expand All @@ -28,47 +27,45 @@ void changeSize(int w, int h)
glMatrixMode(GL_MODELVIEW);
}


void renderScene(void)
{
// clear buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// set camera
glLoadIdentity();
gluLookAt(0.0f, 0.0f, 5.0f,
0.0f, 0.0f, -1.0f,
0.0f, 1.0f, 0.0f);
0.0f, 0.0f, -1.0f,
0.0f, 1.0f, 0.0f);

// put drawing instructions here
glutWireTeapot(1);

// End of frame
glutSwapBuffers();
}


int main(int argc, char** argv)
int main(int argc, char **argv)
{
// put GLUTs init here
// put GLUTs init here
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100, 100);
glutInitWindowSize(800, 800);
glutCreateWindow("CG@DI");

// put callback registry here
glutReshapeFunc(changeSize);
glutIdleFunc(renderScene);
glutDisplayFunc(renderScene);

// some OpenGL settings
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// enter GLUTs main cycle

// enter GLUTs main cycle
glutMainLoop();

return 1;
}
6 changes: 4 additions & 2 deletions src/figure.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include "figure.hpp"
#include <fstream>

Figure::Figure(){
Figure::Figure()
{
points = std::vector<Point>();
}

void Figure::exportFile(std::string filename){
void Figure::exportFile(std::string filename)
{
std::ofstream file(filename);
file << "Test\n";
file.close();
Expand Down
13 changes: 8 additions & 5 deletions src/figure_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@

// This is a placeholder for the actual implementation of the functions

std::unique_ptr<Figure> generatePlane(float length, int divisions){
std::unique_ptr<Figure> generatePlane(float length, int divisions)
{
std::cout << "Generating Plane\n";
return std::make_unique<Figure>();
}

std::unique_ptr<Figure> generateBox(float dimension, int divisions){
std::unique_ptr<Figure> generateBox(float dimension, int divisions)
{
std::cout << "Generating Box\n";
return std::make_unique<Figure>();
}

std::unique_ptr<Figure> generateSphere(float radius, int slices, int stacks){
std::unique_ptr<Figure> generateSphere(float radius, int slices, int stacks)
{
std::cout << "Generating Sphere\n";
return std::make_unique<Figure>();
}

std::unique_ptr<Figure> generateCone(float radius, float height, int slices, int stacks){
std::unique_ptr<Figure> generateCone(float radius, float height, int slices, int stacks)
{
std::cout << "Generating Cone\n";
return std::make_unique<Figure>();
}

3 changes: 2 additions & 1 deletion src/generator.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <iostream>

int main(){
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}

0 comments on commit f1d4338

Please sign in to comment.