53 lines
		
	
	
		
			876 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			876 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "MyGraphicsEngine/Window.h"
 | |
| #include <spdlog/spdlog.h>
 | |
| 
 | |
| 
 | |
| bool BarinkWindow::InitGLFW(){
 | |
| 	if(!glfwInit())
 | |
| 	{
 | |
| 		spdlog::error("Failed to initialise GLFW!");
 | |
| 		return false;
 | |
| 	}
 | |
| 	return true;
 | |
| }
 | |
| 
 | |
| BarinkWindow::BarinkWindow(const int width, const int height) :
 | |
| Width(width), Height(height), FullScreen(false){
 | |
| 	InitGLFW();
 | |
| 
 | |
| 	window = glfwCreateWindow(Width, Height, "BarinkEngine", NULL, NULL);
 | |
| 
 | |
| 	if( !window)
 | |
| 	{
 | |
| 		spdlog::error("GLFW failed to create window!");
 | |
| 		glfwTerminate();
 | |
| 		return;
 | |
| 	}
 | |
| 
 | |
| 	glfwMakeContextCurrent(window);
 | |
| 
 | |
| 	VulkanSupported = glfwVulkanSupported();
 | |
| 
 | |
| 	glfwGetFramebufferSize(window, &Width, &Height);
 | |
| 	glViewport(0,0, Width, Height);
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| }
 | |
| 
 | |
| 
 | |
| BarinkWindow::~BarinkWindow(){
 | |
| 
 | |
| 	glfwTerminate();
 | |
| }
 | |
| 
 | |
| bool BarinkWindow::WindowShouldClose(){
 | |
| 	return glfwWindowShouldClose(window);
 | |
| }
 | |
| 
 | |
| void BarinkWindow::Poll()
 | |
| {
 | |
| 	glfwSwapBuffers(window);
 | |
| 	glfwPollEvents();
 | |
| } |