restructuration
This commit is contained in:
61
src/main.c
Normal file
61
src/main.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* IGC parser
|
||||
* @brief parse IGC file, get all data points, compute average horizontal/vertical speed, print to STDOUT
|
||||
*
|
||||
* As per standard: https://xp-soaring.github.io/igc_file_format/igc_format_2008.html
|
||||
* https://xp-soaring.github.io/igc_file_format/igc_fr_specification_with_al8_2023-2-1_0.pdf
|
||||
*
|
||||
* @author xamidev <xamidev@riseup.net>
|
||||
* @license GNU GPL v3
|
||||
*/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "igc.h"
|
||||
#include "linkage.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
printf("Usage: %s <file>\n", argv[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
char filename[NAME_MAX] = {0};
|
||||
strncpy(filename, argv[1], NAME_MAX-1);
|
||||
|
||||
FILE* fp = fopen(filename, "r");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
printf("Couldn't open file %s\n", filename);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct dp_node* head = create_datapoint_list();
|
||||
struct IGC_Header* hdr = (struct IGC_Header*)calloc(1, sizeof(struct IGC_Header));
|
||||
parse_igc_file(fp, hdr, head);
|
||||
|
||||
print_datapoint_list(head);
|
||||
|
||||
// Raylib test window
|
||||
SetTraceLogLevel(4);
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 600;
|
||||
InitWindow(screenWidth, screenHeight, "Raylib basic window");
|
||||
SetTargetFPS(60);
|
||||
while (!WindowShouldClose()) {
|
||||
BeginDrawing();
|
||||
ClearBackground(RAYWHITE);
|
||||
DrawText("It works!", 20, 20, 20, BLACK);
|
||||
EndDrawing();
|
||||
}
|
||||
CloseWindow();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user