Browse Source

new example project

feature/dependency-graph
Martin Dørum 4 years ago
parent
commit
2453982aed

+ 5
- 0
example-project/constants.c View File

@@ -0,0 +1,5 @@
#include "constants.h"

const int k_window_height = 800;
const int k_window_width = 600;
const char *k_window_title = "Hello World";

+ 5
- 0
example-project/constants.h View File

@@ -0,0 +1,5 @@
#pragma once

extern const int k_window_width;
extern const int k_window_height;
extern const char *k_window_title;

+ 0
- 1
example-project/hello world.c View File

@@ -1 +0,0 @@
int x = 10;

+ 0
- 3
example-project/hello world.h View File

@@ -1,3 +0,0 @@
#pragma once

extern int x;

+ 12
- 6
example-project/main.c View File

@@ -1,10 +1,16 @@
#include <math.h>
#include <stdio.h>
//#bb pkgs := sdl2

#include "hello world.h"

//#bb ldflags := -lm
#include <SDL.h>
#include "constants.h"

int main() {
printf("sin(%i) is %f\n", x, sin(x));
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *win = SDL_CreateWindow(k_window_title,
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
k_window_width, k_window_height, 0);

SDL_Delay(5000);

SDL_DestroyWindow(win);
SDL_Quit();
}

Loading…
Cancel
Save