Merge branch 'master' of ssh://bitsetter.de:8090/netsl
This commit is contained in:
commit
c941e7809e
22
Makefile
22
Makefile
|
@ -1,25 +1,23 @@
|
|||
|
||||
CFLAGS=-g -Wall -Wextra -std=gnu99
|
||||
BIN_DIR=bin
|
||||
SRC_DIR=src
|
||||
TARGET=$(BIN_DIR)/netsl
|
||||
OBJECTS=$(BIN_DIR)/main.o $(BIN_DIR)/msg.o $(BIN_DIR)/net.o $(BIN_DIR)/display.o
|
||||
BIN=bin
|
||||
SRC=src
|
||||
TARGET=$(BIN)/netsl
|
||||
OBJECTS=$(BIN)/main.o $(BIN)/msg.o $(BIN)/net.o $(BIN)/display.o
|
||||
|
||||
all: $(BIN_DIR) $(TARGET)
|
||||
all: $(BIN) $(TARGET)
|
||||
|
||||
$(BIN_DIR):
|
||||
mkdir -pv $(BIN_DIR)
|
||||
$(BIN):
|
||||
mkdir -pv $(BIN)
|
||||
|
||||
$(TARGET): $(OBJECTS)
|
||||
gcc $^ -o $(TARGET)
|
||||
|
||||
# mkdir -pv $(BIN_DIR)
|
||||
# mkdir -pv $(BIN)
|
||||
|
||||
$(BIN_DIR)/%.o: $(SRC_DIR)/%.c $(SRC_DIR)/%.h
|
||||
$(BIN)/%.o: $(SRC)/%.c $(SRC)/%.h
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)
|
||||
|
||||
rm -rf $(BIN)
|
||||
|
||||
|
|
|
@ -1,6 +1,47 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "display.h"
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
void setup_display() {
|
||||
initscr(); // ncurses initialization
|
||||
curs_set(0); // invisible cursor
|
||||
}
|
||||
|
||||
void cleanup_display() {
|
||||
endwin(); // clean ncurses shutdown
|
||||
}
|
||||
|
||||
/*
|
||||
image[row][col] >>> image[row*width+col];
|
||||
|
||||
uint32_t width; // normally 80
|
||||
uint32_t height; // normally 25, may vary
|
||||
char *image; // dimension is width x height
|
||||
*/
|
||||
void print_current_image(message* msg, int start, int end) {
|
||||
// end is ignored and 80 is used, should be considered later
|
||||
|
||||
move(0,0); // start in the upper left corner
|
||||
char *pic = msg->img; // get a ptr to the actual image
|
||||
|
||||
for (int row=0; row < 25; row++) { // iterate rows
|
||||
char *line = (char*) malloc(81);
|
||||
strcpy(line, strtok(pic, '\n')); // get a line
|
||||
line[80] = '\0'; // terminate
|
||||
printw("%s", line+start);
|
||||
}
|
||||
|
||||
refresh(); // refresh the screen
|
||||
|
||||
}
|
||||
|
||||
|
||||
void callback(const struct message *msg) {
|
||||
printf("in callback, tst=%d\n", msg->timestamp);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
#include <stdio.h>
|
||||
#include "msg.h"
|
||||
|
||||
void setup_display();
|
||||
void cleanup_display();
|
||||
|
||||
void callback(const struct message *msg);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// _,-' \%/|%
|
||||
// / / ) __,-- /%\
|
||||
// \__/_,-'%(% ; %)%
|
||||
// %\%, %\
|
||||
// '--%'
|
||||
//
|
||||
// / %\%, %\
|
||||
// / '--%'
|
||||
// /
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue
Block a user