Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added blitting functions and generally improved things
- Loading branch information
Showing
13 changed files
with
208 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
################################# | ||
# libkiss CMake Build File # | ||
################################# | ||
|
||
PROJECT(libkiss) | ||
|
||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) | ||
|
||
SET(INCLUDE ${libkiss_SOURCE_DIR}/include) | ||
SET(SRC ${libkiss_SOURCE_DIR}/src) | ||
|
||
INCLUDE_DIRECTORIES(${INCLUDE}) | ||
|
||
FILE(GLOB INCLUDES ${INCLUDE}/*.h ${SRC}/*.h) | ||
SET(SOURCES | ||
${SRC}/graphics_interface.c | ||
${SRC}/kiss.c | ||
${SRC}/kiss_graphics.c | ||
${SRC}/kiss_graphics_draw.c | ||
${SRC}/kiss_input.c | ||
${SRC}/kiss_serial_buffer.c | ||
${SRC}/kiss_util.c | ||
${SRC}/serial_interface.c | ||
${SRC}/thread_interface.c | ||
${SRC}/timing_interface.c | ||
) | ||
|
||
IF(UNIX) | ||
SET(SOURCES ${SOURCES} | ||
${SRC}/kiss_serial_unix.c | ||
) | ||
ELSEIF(WIN32) | ||
SET(SOURCES ${SOURCES} | ||
${SRC}/kiss_serial_windows.c | ||
) | ||
ENDIF(UNIX) | ||
|
||
SET(CMAKE_CXX_FLAGS "-Wall") | ||
|
||
IF(APPLE) | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch x86_64 -g") | ||
ELSEIF(WIN32) | ||
SET(CMAKE_CXX_FLAGS "-Wl,--enable-auto-import") | ||
ELSEIF(UNIX) | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") | ||
ENDIF() | ||
|
||
SET(LIBRARY_OUTPUT_PATH ${libkiss_SOURCE_DIR}/lib) | ||
|
||
ADD_LIBRARY(kiss STATIC ${SOURCES}) | ||
TARGET_LINK_LIBRARIES(kiss pthread glfw) | ||
|
||
IF(APPLE) | ||
FIND_LIBRARY(OPENGL_LIBRARY OpenGL) | ||
target_link_libraries(kiss ${OPENGL_LIBRARY}) | ||
ELSE(APPLE) | ||
target_link_libraries(kiss opengl) | ||
ENDIF(APPLE) | ||
|
||
|
||
install(FILES ${INCLUDES} DESTINATION include/kiss) | ||
INSTALL(TARGETS kiss ARCHIVE DESTINATION lib) | ||
|
||
add_subdirectory(test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(camera) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ADD_EXECUTABLE(camera camera.c) | ||
TARGET_LINK_LIBRARIES(camera kiss blobtastic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <kiss-graphics.h> | ||
#include <kiss-input.h> | ||
#include <blobtastic/camera.h> | ||
|
||
void update() | ||
{ | ||
camera_update(); | ||
graphics_blit(get_camera_frame(), 0, 0, get_camera_frame_width(), get_camera_frame_height()); | ||
graphics_update(); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
// Open the default camera | ||
if(!camera_open()) { | ||
printf("Unable to open camera. Is there one plugged in?\n"); | ||
return 1; | ||
} | ||
|
||
// Get the first frame | ||
camera_update(); | ||
|
||
graphics_init(get_camera_frame_width(), get_camera_frame_height()); | ||
|
||
unsigned char ***myFrame; | ||
myFrame = (unsigned char ***)get_camera_frame(); | ||
|
||
printf("R(100, 100) = %u\n", myFrame[100][100][0]); | ||
|
||
while(!kiss_get_key_bit('A')) { | ||
update(); | ||
} | ||
|
||
|
||
|
||
graphics_quit(); | ||
camera_close(); | ||
|
||
return 0; | ||
} |