Console: Carbon support

This commit is contained in:
Wolfgang Thaller 2015-10-12 01:02:21 +02:00
parent 9866de71bb
commit 2187affef2
4 changed files with 23 additions and 12 deletions

View File

@ -36,10 +36,8 @@ link_directories(${CMAKE_CURRENT_BINARY_DIR}/libretro)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libretro) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libretro)
set(REZ_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libretro:${CMAKE_INSTALL_PREFIX}/RIncludes" ) set(REZ_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libretro:${CMAKE_INSTALL_PREFIX}/RIncludes" )
if(NOT (CMAKE_SYSTEM_NAME MATCHES RetroCarbon))
add_subdirectory(Console) add_subdirectory(Console)
add_subdirectory(Samples/HelloWorld) add_subdirectory(Samples/HelloWorld)
endif()
add_subdirectory(TestApps) add_subdirectory(TestApps)
add_subdirectory(Samples/Dialog) add_subdirectory(Samples/Dialog)
add_subdirectory(Samples/Raytracer) add_subdirectory(Samples/Raytracer)

View File

@ -202,7 +202,7 @@ std::string Console::ReadLine()
{ {
do do
{ {
while(!GetOSEvent(everyEvent, &event)) while(!GetNextEvent(everyEvent, &event))
; ;
} while(event.what != keyDown && event.what != autoKey); } while(event.what != keyDown && event.what != autoKey);
@ -230,4 +230,3 @@ std::string Console::ReadLine()
} while(c != '\n'); } while(c != '\n');
return buffer; return buffer;
} }

View File

@ -44,19 +44,36 @@ void Retro::InitConsole()
return; return;
WindowPtr win; WindowPtr win;
GrafPtr port;
#if !TARGET_API_MAC_CARBON
InitGraf(&qd.thePort); InitGraf(&qd.thePort);
InitFonts(); InitFonts();
InitWindows(); InitWindows();
InitMenus(); InitMenus();
Rect r; Rect r = qd.screenBits.bounds;
SetRect(&r, qd.screenBits.bounds.left + 5, qd.screenBits.bounds.top + 45, qd.screenBits.bounds.right - 5, qd.screenBits.bounds.bottom -5); #else
Rect r = (*GetMainDevice())->gdRect;
#endif
r.top += 40;
InsetRect(&r, 5,5);
win = NewWindow(NULL, &r, "\pRetro68 Console", true, 0, (WindowPtr)-1, false, 0); win = NewWindow(NULL, &r, "\pRetro68 Console", true, 0, (WindowPtr)-1, false, 0);
SetPort(win); #if !TARGET_API_MAC_CARBON
EraseRect(&win->portRect); port = win;
Rect portRect = port->portRect;
#else
port = GetWindowPort(win);
Rect portRect;
GetPortBounds(port, &portRect);
#endif
Console *console = new Console(win, win->portRect); SetPort(port);
EraseRect(&portRect);
Console *console = new Console(port, portRect);
} }
extern "C" ssize_t _consolewrite(int fd, const void *buf, size_t count) extern "C" ssize_t _consolewrite(int fd, const void *buf, size_t count)

View File

@ -20,11 +20,8 @@ set(CMAKE_CXX_FLAGS "-std=c++11") # -fomit-frame-pointer")
add_application(EmptyTest EmptyTest.c) add_application(EmptyTest EmptyTest.c)
if(CMAKE_SYSTEM_NAME MATCHES RetroCarbon)
else()
add_application(ExceptionTest CONSOLE ExceptionTest.cc) add_application(ExceptionTest CONSOLE ExceptionTest.cc)
add_application(InitTest CONSOLE InitTest.cc) add_application(InitTest CONSOLE InitTest.cc)
endif()
if(CMAKE_SYSTEM_NAME MATCHES Retro68) if(CMAKE_SYSTEM_NAME MATCHES Retro68)
enable_language(ASM) enable_language(ASM)