mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 10:35:11 -04:00
Untested fixups
This commit is contained in:
parent
6fbc7a6301
commit
bccf27f29f
@ -220,6 +220,7 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_BUILD_MACCLASSIC
|
||||
#define CC_BUILD_HTTPCLIENT
|
||||
#define CC_BUILD_OPENAL
|
||||
#define CC_BUILD_COOPTHREADED
|
||||
#elif defined __sun__
|
||||
#define CC_BUILD_SOLARIS
|
||||
#define CC_BUILD_POSIX
|
||||
|
@ -23,6 +23,7 @@
|
||||
#undef true
|
||||
#undef false
|
||||
#include <MacMemory.h>
|
||||
#include <Timer.h>
|
||||
|
||||
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
|
||||
const cc_result ReturnCode_FileNotFound = ENOENT;
|
||||
@ -107,12 +108,16 @@ void DateTime_CurrentLocal(struct DateTime* t) {
|
||||
#define NS_PER_SEC 1000000000ULL
|
||||
|
||||
cc_uint64 Stopwatch_Measure(void) {
|
||||
return clock();
|
||||
//return TickCount();
|
||||
UnsignedWide count;
|
||||
Microseconds(&count);
|
||||
return (cc_uint64)count.lo | ((cc_uint64)count.hi << 32);
|
||||
}
|
||||
|
||||
cc_uint64 Stopwatch_ElapsedMicroseconds(cc_uint64 beg, cc_uint64 end) {
|
||||
if (end < beg) return 0;
|
||||
return (end - beg) / 1000;
|
||||
return end - beg;
|
||||
//return (end - beg) / 1000;
|
||||
}
|
||||
|
||||
void Stopwatch_Init(void) {
|
||||
|
@ -14,67 +14,74 @@
|
||||
#include <Dialogs.h>
|
||||
#include <Fonts.h>
|
||||
#include <Events.h>
|
||||
static WindowPtr win;
|
||||
Rect r;
|
||||
BitMap bitmapScreen;
|
||||
#include <Scrap.h>
|
||||
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 224
|
||||
static cc_bool launcherMode = true;
|
||||
static WindowPtr win;
|
||||
static cc_bool launcherMode;
|
||||
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------Public implementation--------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Window_PreInit(void) { }
|
||||
void Window_Init(void) {
|
||||
DisplayInfo.Width = SCREEN_WIDTH;
|
||||
DisplayInfo.Height = SCREEN_HEIGHT;
|
||||
DisplayInfo.ScaleX = 0.5f;
|
||||
DisplayInfo.ScaleY = 0.5f;
|
||||
|
||||
Window_Main.Width = DisplayInfo.Width;
|
||||
Window_Main.Height = DisplayInfo.Height;
|
||||
Window_Main.Focused = true;
|
||||
Window_Main.Exists = true;
|
||||
|
||||
Input.Sources = INPUT_SOURCE_GAMEPAD;
|
||||
DisplayInfo.ContentOffsetX = 10;
|
||||
DisplayInfo.ContentOffsetY = 10;
|
||||
|
||||
InitGraf(&qd.thePort);
|
||||
InitFonts();
|
||||
InitWindows();
|
||||
InitMenus();
|
||||
InitDialogs(NULL);
|
||||
InitCursor();
|
||||
|
||||
FlushEvents(everyEvent, 0);
|
||||
|
||||
Rect r = qd.screenBits.bounds;
|
||||
DisplayInfo.x = r.left;
|
||||
DisplayInfo.y = r.top;
|
||||
DisplayInfo.Width = r.right - r.left; // TODO +1 or not?
|
||||
DisplayInfo.Height = r.bottom - r.top;
|
||||
|
||||
DisplayInfo.ScaleX = 1.0f;
|
||||
DisplayInfo.ScaleY = 1.0f;
|
||||
}
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
static void DoCreateWindow(int width, int height) {
|
||||
r = qd.screenBits.bounds;
|
||||
Rect windR;
|
||||
/* TODO: Make less-crap method of getting center. */
|
||||
int centerX = r.right/2; int centerY = r.bottom/2;
|
||||
int ww = (SCREEN_WIDTH/2); int hh = (SCREEN_HEIGHT/2);
|
||||
SetRect(&bitmapScreen.bounds, 0, 0, width, height);
|
||||
int middleX = Display_CentreX(width);
|
||||
int middleY = Display_CentreY(height);
|
||||
|
||||
// TODO
|
||||
SetRect(&windR, centerX-ww, centerY-hh, centerX+ww, centerY+hh);
|
||||
SetRect(&windR, middleX - width / 2, middleY - height / 2,
|
||||
middleX + width / 2, middleY + height / 2);
|
||||
win = NewWindow(NULL, &windR, "\pClassiCube", true, 0, (WindowPtr)-1, false, 0);
|
||||
SetPort(win);
|
||||
|
||||
Window_Main.Width = width;
|
||||
Window_Main.Height = height;
|
||||
Window_Main.Focused = true;
|
||||
Window_Main.Exists = true;
|
||||
}
|
||||
|
||||
void Window_Create2D(int width, int height) { launcherMode=true; DoCreateWindow(width, height); }
|
||||
void Window_Create3D(int width, int height) { launcherMode=false; DoCreateWindow(width, height); }
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; DoCreateWindow(width, height); }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; DoCreateWindow(width, height); }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Clipboard_GetText(cc_string* value) {
|
||||
Handle tmp = NewHandle(0);
|
||||
HLock(tmp);
|
||||
int dataSize = GetScrap(tmp, 'TEXT', 0);
|
||||
HUnlock(tmp);
|
||||
|
||||
String_AppendAll(value, (char*)tmp, dataSize);
|
||||
DisposeHandle(tmp);
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Clipboard_SetText(const cc_string* value) {
|
||||
PutScrap(value->length, 'TEXT', value->buffer);
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -108,7 +115,10 @@ void Window_RequestClose(void) {
|
||||
}
|
||||
|
||||
void Window_ProcessEvents(float delta) {
|
||||
// TODO
|
||||
EventRecord event;
|
||||
|
||||
while (GetNextEvent(everyEvent, &event)) {
|
||||
}
|
||||
}
|
||||
|
||||
short isPressed(unsigned short k) {
|
||||
@ -118,9 +128,7 @@ short isPressed(unsigned short k) {
|
||||
return ((km[k>>3] >> (k&7) ) &1);
|
||||
}
|
||||
|
||||
int theKeys;
|
||||
void Window_ProcessGamepads(float delta) {
|
||||
GetKeys(theKeys);
|
||||
Gamepad_SetButton(0, CCPAD_UP, isPressed(0x0D));
|
||||
Gamepad_SetButton(0, CCPAD_DOWN, isPressed(0x01));
|
||||
Gamepad_SetButton(0, CCPAD_START, isPressed(0x24));
|
||||
@ -128,14 +136,18 @@ void Window_ProcessGamepads(float delta) {
|
||||
|
||||
static void Cursor_GetRawPos(int* x, int* y) {
|
||||
// TODO
|
||||
*x=0;*y=0;
|
||||
*x=0;*y=0;
|
||||
}
|
||||
|
||||
void Cursor_SetPosition(int x, int y) {
|
||||
// TODO
|
||||
}
|
||||
static void Cursor_DoSetVisible(cc_bool visible) {
|
||||
// TODO
|
||||
if (visible) {
|
||||
ShowCursor();
|
||||
} else {
|
||||
HideCursor();
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowDialogCore(const char* title, const char* msg) {
|
||||
@ -156,7 +168,6 @@ void Window_AllocFramebuffer(struct Bitmap* bmp) {
|
||||
bmp->scan0 = (BitmapCol*)Mem_Alloc(bmp->width * bmp->height, 4, "window pixels");
|
||||
}
|
||||
|
||||
#define GetWindowPort(w) w
|
||||
void Window_DrawFramebuffer(Rect2D r, struct Bitmap* bmp) {
|
||||
// Grab Window port.
|
||||
GrafPtr thePort = GetWindowPort(win);
|
||||
|
Loading…
x
Reference in New Issue
Block a user