mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
[nctetris] find the background everywhere #2042
This commit is contained in:
parent
744e1ce015
commit
238de45e96
@ -608,11 +608,12 @@ target_link_libraries(notcurses-input
|
|||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
# nctetris
|
# nctetris
|
||||||
file(GLOB TETRISSRC CONFIGURE_DEPENDS src/tetris/*.cpp)
|
file(GLOB TETRISSRC CONFIGURE_DEPENDS src/tetris/*.cpp src/compat/*.c)
|
||||||
add_executable(nctetris ${TETRISSRC})
|
add_executable(nctetris ${TETRISSRC})
|
||||||
target_include_directories(nctetris
|
target_include_directories(nctetris
|
||||||
BEFORE
|
BEFORE
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
src
|
||||||
include
|
include
|
||||||
"${CMAKE_REQUIRED_INCLUDES}"
|
"${CMAKE_REQUIRED_INCLUDES}"
|
||||||
"${PROJECT_BINARY_DIR}/include"
|
"${PROJECT_BINARY_DIR}/include"
|
||||||
|
@ -116,6 +116,26 @@ int clock_nanosleep(clockid_t clockid, int flags,
|
|||||||
const struct timespec *request,
|
const struct timespec *request,
|
||||||
struct timespec *remain);
|
struct timespec *remain);
|
||||||
|
|
||||||
|
static inline char*
|
||||||
|
notcurses_data_path(const char* f){
|
||||||
|
char* datadir = notcurses_data_dir();
|
||||||
|
if(datadir == NULL){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
const size_t dlen = strlen(datadir);
|
||||||
|
// cast is for benefit of c++ callers, sigh
|
||||||
|
char* path = (char*)malloc(dlen + 1 + strlen(f) + 1);
|
||||||
|
if(path == NULL){
|
||||||
|
free(datadir);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
strcpy(path, datadir);
|
||||||
|
free(datadir);
|
||||||
|
path[dlen] = path_separator();
|
||||||
|
strcpy(path + dlen + 1, f);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -44,12 +44,7 @@ const demoresult* demoresult_lookup(int idx){
|
|||||||
}
|
}
|
||||||
|
|
||||||
char* find_data(const char* datum){
|
char* find_data(const char* datum){
|
||||||
const size_t dlen = strlen(datadir);
|
return notcurses_data_path(datum);
|
||||||
char* path = malloc(dlen + 1 + strlen(datum) + 1);
|
|
||||||
strcpy(path, datadir);
|
|
||||||
path[dlen] = path_separator();
|
|
||||||
strcpy(path + dlen + 1, datum);
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float delaymultiplier = 1;
|
float delaymultiplier = 1;
|
||||||
|
@ -2275,8 +2275,8 @@ internal_get(inputctx* ictx, const struct timespec* ts, ncinput* ni){
|
|||||||
sendsignal = true;
|
sendsignal = true;
|
||||||
}else{
|
}else{
|
||||||
logtrace("draining event readiness pipe %d\n", ictx->ivalid);
|
logtrace("draining event readiness pipe %d\n", ictx->ivalid);
|
||||||
char c;
|
|
||||||
#ifndef __MINGW64__
|
#ifndef __MINGW64__
|
||||||
|
char c;
|
||||||
while(read(ictx->readypipes[0], &c, sizeof(c)) == 1){
|
while(read(ictx->readypipes[0], &c, sizeof(c)) == 1){
|
||||||
// FIXME accelerate?
|
// FIXME accelerate?
|
||||||
}
|
}
|
||||||
|
@ -11,19 +11,14 @@
|
|||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <ncpp/NotCurses.hh>
|
#include <ncpp/NotCurses.hh>
|
||||||
#include <ncpp/Visual.hh>
|
#include <ncpp/Visual.hh>
|
||||||
|
#include "compat/compat.h"
|
||||||
#include "builddef.h"
|
#include "builddef.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
std::mutex ncmtx;
|
std::mutex ncmtx;
|
||||||
|
|
||||||
#ifdef __MINGW64__
|
const std::string BackgroundFile = notcurses_data_path("tetris-background.jpg");
|
||||||
#define PATHSEP "\\"
|
const std::string LogoFile = notcurses_data_path("notcurses.png");
|
||||||
#else
|
|
||||||
#define PATHSEP "/"
|
|
||||||
#endif
|
|
||||||
const std::string BackgroundFile = NOTCURSES_SHARE PATHSEP "tetris-background.jpg";
|
|
||||||
const std::string LogoFile = NOTCURSES_SHARE PATHSEP "notcurses.png";
|
|
||||||
#undef PATHSEP
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user