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)
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(Samples/HelloWorld)
endif()
add_subdirectory(TestApps)
add_subdirectory(Samples/Dialog)
add_subdirectory(Samples/Raytracer)

View File

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

View File

@ -44,19 +44,36 @@ void Retro::InitConsole()
return;
WindowPtr win;
GrafPtr port;
#if !TARGET_API_MAC_CARBON
InitGraf(&qd.thePort);
InitFonts();
InitWindows();
InitMenus();
Rect r;
SetRect(&r, qd.screenBits.bounds.left + 5, qd.screenBits.bounds.top + 45, qd.screenBits.bounds.right - 5, qd.screenBits.bounds.bottom -5);
Rect r = qd.screenBits.bounds;
#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);
SetPort(win);
EraseRect(&win->portRect);
#if !TARGET_API_MAC_CARBON
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)

View File

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