1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-01 08:00:37 +00:00

Revert "Fixes #90"

This reverts commit af0c41316a.
This commit is contained in:
FellippeHeitor 2019-03-31 21:01:59 -03:00
parent 982ea40daf
commit 62acc0710c
5 changed files with 13 additions and 97 deletions

View file

@ -22,17 +22,6 @@
#endif
#ifndef QB64_WINDOWS
#include <curses.h>
#include <term.h>
// ncurses defines macros for terminfo capability names, which causes
// conflicts.
#undef create_window
#undef buttons
#undef tab
#undef newline
#endif
int32 disableEvents=0;
@ -11203,66 +11192,7 @@ void qbg_sub_view(int32 x1,int32 y1,int32 x2,int32 y2,int32 fillcolor,int32 bord
return;
}
#ifdef QB64_WINDOWS
static bool clear_console(void)
{
bool ret;
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD origin = {0, 0};
HANDLE hConsole = CreateFileA("CONOUT$",
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
DWORD nCharsWritten;
if (hConsole == INVALID_HANDLE_VALUE)
return false;
ret = (GetConsoleScreenBufferInfo(hConsole, &csbi) &&
FillConsoleOutputCharacterA(console, ' ',
csbi.dwSize.X * csbi.dwSize.Y, origin, &nCharsWritten));
CloseHandle(console);
return ret;
}
#else
// Terminal file descriptor
static int ttyfd;
// putchar replacement acting on ttyfd instead of stdin
static int putc_tty(int c)
{
int nWritten = 0;
unsigned char uc = (unsigned char)c;
if (ttyfd == -1)
return EOF;
while (nWritten == 0)
nWritten = write(ttyfd, &uc, 1);
if (nWritten != 1)
return EOF;
return c;
}
static bool clear_console(void)
{
int err;
ttyfd = open("/dev/tty", O_RDWR);
if (ttyfd == -1) {
// No controlling TTY for the process?
return false;
}
// A non-null err pointer must be passed to prevent the process from
// exiting.
if (ERR == setupterm(NULL, ttyfd, &err)) {
// No matter what the error was, it is ignored, and we
// simply return that there was an error.
return false;
}
char *cls = tigetstr("clear");
if (cls == (char *)-1 || cls == (char *)0) {
return false;
}
tputs(cls, 1, putc_tty);
del_curterm(cur_term);
close(ttyfd);
ttyfd = -1;
return true;
}
#endif
void sub_cls(int32 method,uint32 use_color,int32 passed){
if (new_error) return;
@ -11302,10 +11232,7 @@ void sub_cls(int32 method,uint32 use_color,int32 passed){
if ((passed&1)==0){//no method specified
//video mode: clear only graphics viewport
//text mode: clear text view port AND the bottom line
if (write_page->console){
// TODO: handle background arguments
clear_console();
}else if (write_page->text){
if (write_page->text){
//text view port
characters=write_page->width*(write_page->bottom_row-write_page->top_row+1);
sp=(uint16*)&write_page->offset[(write_page->top_row-1)*write_page->width*2];
@ -11348,10 +11275,7 @@ void sub_cls(int32 method,uint32 use_color,int32 passed){
}
if (method==0){//clear everything
if (write_page->console){
// TODO: handle background arguments
clear_console();
}else if (write_page->text){
if (write_page->text){
characters=write_page->height*write_page->width;
sp=(uint16*)write_page->offset;
for (i=0;i<characters;i++){sp[i]=clearvalue;}
@ -11380,10 +11304,7 @@ void sub_cls(int32 method,uint32 use_color,int32 passed){
}
if (method==1){//ONLY clear the graphics viewport
if (write_page->console){
// TODO: handle background arguments
clear_console();
}else if (write_page->text) return;
if (write_page->text) return;
//graphics view port
if (write_page->bytes_per_pixel==1){//8-bit
if (write_page->clipping_or_scaling){
@ -11414,12 +11335,7 @@ void sub_cls(int32 method,uint32 use_color,int32 passed){
}
if (method==2){//ONLY clear the VIEW PRINT range text viewport
if (write_page->console){
// TODO: handle background arguments
// Once VIEW PRINT is supported in the console, this will need
// handled as well.
clear_console();
}else if (write_page->text){
if (write_page->text){
//text viewport
characters=write_page->width*(write_page->bottom_row-write_page->top_row+1);
sp=(uint16*)&write_page->offset[(write_page->top_row-1)*write_page->width*2];

View file

@ -1,2 +1,2 @@
g++ -w qbx.cpp parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lcurses -lpthread -ldl -lrt -D FREEGLUT_STATIC -o
g++ -w qbx.cpp parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o

View file

@ -1,4 +1,4 @@
g++ -w qbx.cpp -framework OpenGL -framework IOKit -framework GLUT -framework OpenGL -framework Cocoa -lcurses -o
g++ -w qbx.cpp -framework OpenGL -framework IOKit -framework GLUT -framework OpenGL -framework Cocoa -o
(below for reference purposes only, above is minimum viable)
g++ -w qbx.cpp -framework ApplicationServices -framework OpenGL -framework IOKit -framework CoreServices -framework CoreFoundation -framework GLUT -framework OpenGL -framework Cocoa -lcurses -o
g++ -w qbx.cpp -framework ApplicationServices -framework OpenGL -framework IOKit -framework CoreServices -framework CoreFoundation -framework GLUT -framework OpenGL -framework Cocoa -o

View file

@ -105,7 +105,7 @@ if [ "$DISTRO" == "arch" ]; then
if [ "$SDL" == "1" ]; then
pkg_list="gcc sdl sdl_image sdl_mixer sdl_net sdl_ttf $GET_WGET"
else
pkg_list="gcc ncurses $GET_WGET"
pkg_list="gcc $GET_WGET"
fi
installed_packages=`pacman -Q`
installer_command="sudo pacman -S "
@ -115,7 +115,7 @@ elif [ "$DISTRO" == "linuxmint" ] || [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" ==
if [ "$SDL" == "1" ]; then
pkg_list="g++ libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev $GET_WGET"
else
pkg_list="g++ mesa-common-dev libglu1-mesa-dev libncurses-dev libasound2-dev $GET_WGET"
pkg_list="g++ mesa-common-dev libglu1-mesa-dev libasound2-dev $GET_WGET"
fi
installed_packages=`dpkg -l`
installer_command="sudo apt-get -y install "
@ -125,7 +125,7 @@ elif [ "$DISTRO" == "fedora" ] || [ "$DISTRO" == "redhat" ] || [ "$DISTRO" == "c
if [ "$SDL" == "1" ]; then
pkg_list="gcc-c++ SDL-devel SDL_image-devel SDL_mixer-devel SDL_net-devel SDL_ttf-devel $GET_WGET"
else
pkg_list="gcc-c++ mesa-libGLU-devel ncurses-devel alsa-lib-devel $GET_WGET"
pkg_list="gcc-c++ mesa-libGLU-devel alsa-lib-devel $GET_WGET"
fi
installed_packages=`yum list installed`
installer_command="sudo yum install "
@ -192,7 +192,7 @@ else
echo "Building 'QB64'"
cp -r ./internal/source/* ./internal/temp/
cd internal/c
g++ -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lcurses -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64
g++ -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64
cd ../..
fi

View file

@ -47,7 +47,7 @@ cd ../../../../../../../..
echo "Building 'QB64' (~3 min)"
cp ./internal/source/* ./internal/temp/
cd internal/c
g++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -lcurses -o ../../qb64
g++ -w qbx.cpp libqb/os/osx/libqb_setup.o parts/video/font/ttf/os/osx/src.o -framework GLUT -framework OpenGL -framework Cocoa -o ../../qb64
cd ../..
echo ""