Unbewohnte
3 years ago
5 changed files with 47 additions and 52 deletions
@ -1,6 +1,2 @@
|
||||
/build/CMakeFiles |
||||
/build/cmake_install.cmake |
||||
/build/Makefile |
||||
/build/CMakeCache.txt |
||||
/bin |
||||
image.ppm |
||||
test |
@ -1,21 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.10) |
||||
|
||||
project(rwpnm) |
||||
|
||||
set(CMAKE_CXX_STANDARD 17) |
||||
set(CMAKE_CXX_STANDARD_REQUIRED True) |
||||
|
||||
IF(MSVC) |
||||
# to be made, probably... |
||||
else() |
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") |
||||
set(BUILD_SHARED_LIBS OFF) |
||||
set(CMAKE_EXE_LINKER_FLAGS "-static") |
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O2") |
||||
endif() |
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ../bin) |
||||
|
||||
FILE(GLOB source_files ../src/*) |
||||
add_executable(rwpnm ${source_files}) |
@ -0,0 +1,8 @@
|
||||
test: all |
||||
./test
|
||||
|
||||
all: |
||||
g++ test.cpp -Wall -Werror -O2 -static -o test
|
||||
|
||||
clear: |
||||
rm -f test image.ppm
|
@ -0,0 +1,29 @@
|
||||
#include <iostream> |
||||
#include "../src/pnm.cpp" |
||||
|
||||
using namespace pnm; |
||||
|
||||
int main() { |
||||
try { |
||||
PPM_writer ppm_image(800, 800); |
||||
|
||||
uint8_t cc = 0; |
||||
for (uint32_t y = 0; y < 800; y++) { |
||||
for (uint32_t x = 0; x < 800; x++) { |
||||
ppm_image.put_pixel(x, y, RGB(cc, cc, cc)); |
||||
|
||||
cc++; |
||||
} |
||||
cc--; |
||||
} |
||||
ppm_image.save("image.ppm"); |
||||
|
||||
} catch(const std::exception& e) { |
||||
std::cout << "[ERROR] " << e.what() << "\n"; |
||||
return 1; |
||||
} |
||||
|
||||
std::cout << "[SUCCESS]\n"; |
||||
|
||||
return 0; |
||||
} |
Loading…
Reference in new issue