Compare commits

..

No commits in common. "c8e7a2883731d3b6f360c0f3e03ce2b1fe9a644f" and "b2164b76cf07743dd6b2207d23e041921c796b6b" have entirely different histories.

12 changed files with 3 additions and 1867 deletions

View File

@ -6,7 +6,6 @@ project(glerminal
)
option(GLERMINAL_OPENGL_DEBUG_CONTEXT "" OFF)
option(GLERMINAL_TEST "" OFF)
set(GLERMINAL_GRID_WIDTH 40 CACHE STRING "")
set(GLERMINAL_GRID_HEIGHT 25 CACHE STRING "")
set(GLERMINAL_LAYER_COUNT 64 CACHE STRING "")
@ -64,7 +63,3 @@ endif()
if (PROJECT_IS_TOP_LEVEL)
add_subdirectory(examples examples)
endif()
if (GLERMINAL_TEST)
add_subdirectory(tests tests)
endif()

View File

@ -1,7 +1,6 @@
#include <glerminal.h>
#include <cstdlib>
#include <cmath>
namespace
{

View File

@ -7,8 +7,6 @@ namespace
{
void init()
{
srand(0);
glerminal_load_sprites_file("resources/towers.png");
for (int i = 0; i < LAYER_COUNT; i++)

View File

@ -18,8 +18,6 @@ typedef void (*glerminal_main_cb)(float dt);
*/
void glerminal_run(glerminal_init_cb init, glerminal_main_cb main);
void glerminal_quit();
/**
* @brief Update the displayed screen contents to the current state of the library
*/

View File

@ -1,5 +1,5 @@
#ifndef GLERMINAL_PRIVATE_H
#define GLERMINAL_PRIVATE_H
#ifndef TERMG_PRIVATE_H
#define TERMG_PRIVATE_H
#include "glerminal.h"
@ -34,7 +34,6 @@ namespace glerminal
glerminal& operator=(glerminal&&) = delete;
void run();
void quit();
void flush();
@ -99,4 +98,4 @@ namespace glerminal
};
}
#endif//GLERMINAL_PRIVATE_H
#endif//TERMG_PRIVATE_H

View File

@ -194,11 +194,6 @@ namespace glerminal
}
}
void glerminal::quit()
{
glfwSetWindowShouldClose(m_window, GLFW_TRUE);
}
void glerminal::flush()
{
glNamedBufferData(m_sprites_instance_vbo, sizeof(m_cells), m_cells, GL_STREAM_DRAW);
@ -669,13 +664,6 @@ void glerminal_run(glerminal_init_cb init, glerminal_main_cb main)
}
}
void glerminal_quit()
{
if (!GLERMINAL_G) { return; }
GLERMINAL_G->quit();
}
void glerminal_flush()
{
if (!GLERMINAL_G) { return; }

View File

@ -1,56 +0,0 @@
cmake_minimum_required(VERSION 3.28)
set(CMAKE_FOLDER tests)
add_library(test-common STATIC
${CMAKE_SOURCE_DIR}/source/glad/glad.h
test-common/test-common.h
test-common/stb_image_write.h
test-common/test-common.cpp
)
target_include_directories(test-common
PUBLIC
test-common
PRIVATE
${CMAKE_SOURCE_DIR}/source
)
target_link_libraries(test-common PRIVATE glerminal)
file(GLOB_RECURSE
TEST_RESOURCES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/resources/**.png
)
foreach(RESOURCE_FILE ${TEST_RESOURCES})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RESOURCE_FILE}
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_FILE}
${CMAKE_CURRENT_BINARY_DIR}/${RESOURCE_FILE}
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE_FILE}
)
endforeach()
file(GLOB_RECURSE
TEST_SOURCES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
)
list(REMOVE_ITEM TEST_SOURCES test-common/test-common.cpp)
list(TRANSFORM TEST_RESOURCES PREPEND ${CMAKE_CURRENT_BINARY_DIR}/)
foreach(SOURCE_FILE ${TEST_SOURCES})
get_filename_component(SOURCE_FILENAME ${SOURCE_FILE} NAME_WLE)
add_executable(test-${SOURCE_FILENAME} WIN32 ${SOURCE_FILE} ${TEST_RESOURCES})
target_link_libraries(test-${SOURCE_FILENAME} PRIVATE glerminal test-common)
endforeach()

View File

@ -1,31 +0,0 @@
#include <glerminal.h>
#include <test-common.h>
namespace
{
void init()
{
glerminal_load_sprites_file("resources/image.png");
for (int i = 0; i < GRID_HEIGHT; i++)
{
glerminal_set(i, i, 0, 1);
}
glerminal_flush();
glerminal_test_save_image();
glerminal_quit();
}
void mainloop(float) {}
}
int main()
{
glerminal_run(init, mainloop);
return 0;
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:05ec57e986f3fbd9efcc6c9f8e571393af4db90d8eb92f041990ed690bddaf89
size 196

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
#include <test-common.h>
#include <glerminal.h>
#include <glad/glad.h>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <stb_image_write.h>
namespace
{
unsigned char pixels[1280 * 800 * 3];
}
void glerminal_test_save_image()
{
glReadBuffer(GL_LEFT);
glReadPixels(0, 0, GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, GL_RGB, GL_UNSIGNED_BYTE, pixels);
stbi_flip_vertically_on_write(true);
stbi_write_png("image.png", GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, 3, pixels, 1280 * 3);
}

View File

@ -1,6 +0,0 @@
#ifndef GLERMINAL_TEST_COMMON_H
#define GLERMINAL_TEST_COMMON_H
void glerminal_test_save_image();
#endif//GLERMINAL_TEST_COMMON_H