Use CC for general compiling; get rid of more printfs; display opengl version on load

This commit is contained in:
2022-11-23 23:29:50 +00:00
parent 29c001e7df
commit a0f016a011
8 changed files with 80 additions and 103 deletions

View File

@@ -50,7 +50,8 @@ void engine_init()
glfwSetErrorCallback(error_callback);
/* Initialize GLFW */
if (!glfwInit()) {
printf("Could not init GLFW\n");
YughError("Could not init GLFW. Exiting.");
exit(1);
}

View File

@@ -1,6 +1,7 @@
#ifndef RENDER_H
#define RENDER_H
#define GLFW_INCLUDE_NONE
#include <glad/gl.h>
#include <GLFW/glfw3.h>

View File

@@ -1,5 +1,4 @@
#include "timer.h"
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stb_ds.h>;
@@ -100,4 +99,4 @@ void arrwalk(void *arr, void (*fn)(void *data))
{
for (int i = 0; i < arrlen(arr); i++)
fn(&arr[i]);
}
}

View File

@@ -89,7 +89,12 @@ struct window *MakeSDLWindow(const char *name, int width, int height, uint32_t f
}
glfwMakeContextCurrent(w.window);
gladLoadGL(glfwGetProcAddress);
int version = gladLoadGL(glfwGetProcAddress);
if (!version) {
YughError("Failed to initialize OpenGL context.");
exit(1);
}
YughInfo("Loaded OpenGL %d.%d", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
glfwSwapInterval(1);
// Set callbacks

View File

@@ -1,28 +1,62 @@
class Component
class Method
def source(n=5)
loc = source_location
puts `sed -n "#{loc[1]},#{loc[1]+n}p;#{loc[1]+6}q" #{loc[0]}`
end
end
class Sprite
class Music
def initialize(mpath = "")
load(mpath);
end
def load(mpath)
#@music = load(path);
end
def play
end
end
class CircleCollider2D
class Sound
def initialize(path = "")
load(path);
end
def load(path)
#@sound =
end
def play
end
end
class Segment2D
def checknewer
$maketimes ||= {}
file = caller[0].split(":")[0]
if $maketimes[file].nil?
$maketimes[file] = `stat --printf '%Y' #{file}`
return
end
newtime = `stat --printf '%Y' #{file}`
if newtime > $maketimes[file]
load(file)
end
end
class Box2D
def set_renderms(val)
settings_cmd(0, val);
end
class Polygon2D
def set_updatems(val)
settings_cmd(1, val);
end
class Edge2D
def set_physms(val)
settings_cmd(2, val);
end