Variable name/debugging output changes
This commit is contained in:
parent
96dd15dd3d
commit
20af8e0677
3 changed files with 99 additions and 114 deletions
|
@ -64,47 +64,46 @@ class SDL_BWin:public BDirectWindow
|
||||||
SDL_BWin(BRect bounds):BDirectWindow(bounds, "Untitled",
|
SDL_BWin(BRect bounds):BDirectWindow(bounds, "Untitled",
|
||||||
B_TITLED_WINDOW, 0)
|
B_TITLED_WINDOW, 0)
|
||||||
{
|
{
|
||||||
last_buttons = 0;
|
_last_buttons = 0;
|
||||||
printf("SDL_BWin.h: 69\n");
|
|
||||||
|
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL
|
||||||
SDL_GLView = NULL;
|
_SDL_GLView = NULL;
|
||||||
#endif
|
#endif
|
||||||
_shown = false;
|
_shown = false;
|
||||||
inhibit_resize = false;
|
_inhibit_resize = false;
|
||||||
mouse_focused = false;
|
_mouse_focused = false;
|
||||||
prev_frame = NULL; printf("SDL_BWin.h: 79\n");
|
_prev_frame = NULL;
|
||||||
|
|
||||||
/* Handle framebuffer stuff */
|
/* Handle framebuffer stuff */
|
||||||
_connected = connection_disabled = false;
|
_connected = _connection_disabled = false;
|
||||||
trash_window_buffer = false;
|
_trash__window_buffer = false;
|
||||||
buffer_locker = new BLocker();
|
_buffer_locker = new BLocker();
|
||||||
window_buffer = NULL;
|
_window_buffer = NULL;
|
||||||
// LockBuffer(); /* Unlocked by buffer initialization */
|
// LockBuffer(); /* Unlocked by buffer initialization */
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ SDL_BWin()
|
virtual ~ SDL_BWin()
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
connection_disabled = true;
|
_connection_disabled = true;
|
||||||
|
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL
|
||||||
if (SDL_GLView) {
|
if (_SDL_GLView) {
|
||||||
SDL_GLView->UnlockGL();
|
_SDL_GLView->UnlockGL();
|
||||||
}
|
}
|
||||||
RemoveChild(SDL_GLView);
|
RemoveChild(_SDL_GLView);
|
||||||
#endif
|
#endif
|
||||||
Unlock();
|
Unlock();
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL
|
||||||
if (SDL_GLView) {
|
if (_SDL_GLView) {
|
||||||
delete SDL_GLView;
|
delete _SDL_GLView;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Clean up framebuffer stuff */
|
/* Clean up framebuffer stuff */
|
||||||
buffer_locker->Lock();
|
_buffer_locker->Lock();
|
||||||
free(_clips);
|
free(_clips);
|
||||||
delete buffer_locker;
|
delete _buffer_locker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,24 +116,24 @@ printf("SDL_BWin.h: 69\n");
|
||||||
retval = 0;
|
retval = 0;
|
||||||
Lock();
|
Lock();
|
||||||
if (flags & SDL_OPENGL/*SDL_INTERNALOPENGL*/) {
|
if (flags & SDL_OPENGL/*SDL_INTERNALOPENGL*/) {
|
||||||
if (SDL_GLView == NULL) {
|
if (_SDL_GLView == NULL) {
|
||||||
SDL_GLView = new BGLView(Bounds(), "SDL GLView",
|
_SDL_GLView = new BGLView(Bounds(), "SDL GLView",
|
||||||
B_FOLLOW_ALL_SIDES,
|
B_FOLLOW_ALL_SIDES,
|
||||||
(B_WILL_DRAW | B_FRAME_EVENTS),
|
(B_WILL_DRAW | B_FRAME_EVENTS),
|
||||||
gl_flags);
|
gl_flags);
|
||||||
}
|
}
|
||||||
if (the_view != SDL_GLView) {
|
if (_the_view != _SDL_GLView) {
|
||||||
if (the_view) {
|
if (_the_view) {
|
||||||
RemoveChild(the_view);
|
RemoveChild(_the_view);
|
||||||
}
|
}
|
||||||
AddChild(SDL_GLView);
|
AddChild(_SDL_GLView);
|
||||||
SDL_GLView->LockGL();
|
_SDL_GLView->LockGL();
|
||||||
the_view = SDL_GLView;
|
_the_view = _SDL_GLView;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (the_view) {
|
if (_the_view) {
|
||||||
SDL_GLView->UnlockGL();
|
_SDL_GLView->UnlockGL();
|
||||||
RemoveChild(the_view);
|
RemoveChild(_the_view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Unlock();
|
Unlock();
|
||||||
|
@ -144,41 +143,41 @@ printf("SDL_BWin.h: 69\n");
|
||||||
|
|
||||||
/* * * * * Framebuffering* * * * */
|
/* * * * * Framebuffering* * * * */
|
||||||
virtual void DirectConnected(direct_buffer_info *info) {
|
virtual void DirectConnected(direct_buffer_info *info) {
|
||||||
if(!_connected && connection_disabled) {
|
if(!_connected && _connection_disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LockBuffer();
|
LockBuffer();
|
||||||
|
|
||||||
switch(info->buffer_state & B_DIRECT_MODE_MASK) {
|
switch(info->buffer_state & B_DIRECT_MODE_MASK) {
|
||||||
case B_DIRECT_START:
|
case B_DIRECT_START:
|
||||||
printf(__FILE__": %d; Direct start.\n", __LINE__);
|
|
||||||
_connected = true;
|
_connected = true;
|
||||||
|
|
||||||
case B_DIRECT_MODIFY:
|
case B_DIRECT_MODIFY:
|
||||||
|
|
||||||
if(_clips) {
|
if(_clips) {
|
||||||
free(_clips);
|
free(_clips);
|
||||||
_clips = NULL;
|
_clips = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Can we reuse the window's pixel buffer after this? */
|
/* Can we reuse the window's pixel buffer after this? */
|
||||||
trash_window_buffer = ((info->buffer_state & B_BUFFER_RESIZED)
|
_trash__window_buffer = ((info->buffer_state & B_BUFFER_RESIZED)
|
||||||
|| (info->buffer_state & B_BUFFER_RESET)
|
|| (info->buffer_state & B_BUFFER_RESET)
|
||||||
|| ((info->buffer_state & B_DIRECT_MODE_MASK)
|
|| ((info->buffer_state & B_DIRECT_MODE_MASK)
|
||||||
== B_DIRECT_START));
|
== B_DIRECT_START));
|
||||||
|
|
||||||
num_clips = info->clip_list_count;
|
_num_clips = info->clip_list_count;
|
||||||
_clips = (clipping_rect *)malloc(num_clips*sizeof(clipping_rect));
|
_clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
|
||||||
if(_clips) {
|
if(_clips) {
|
||||||
memcpy(_clips, info->clip_list,
|
memcpy(_clips, info->clip_list,
|
||||||
num_clips*sizeof(clipping_rect));
|
_num_clips*sizeof(clipping_rect));
|
||||||
|
|
||||||
_bits = (uint8*) info->bits;
|
_bits = (uint8*) info->bits;
|
||||||
row_bytes = info->bytes_per_row;
|
_row_bytes = info->bytes_per_row;
|
||||||
_bounds = info->window_bounds;
|
_bounds = info->window_bounds;
|
||||||
bytes_per_px = info->bits_per_pixel / 8;
|
_bytes_per_px = info->bits_per_pixel / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Whatever the case, I think this merits a repaint event */
|
||||||
|
// _RepaintEvent();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_DIRECT_STOP:
|
case B_DIRECT_STOP:
|
||||||
|
@ -218,7 +217,7 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
virtual bool QuitRequested() {
|
virtual bool QuitRequested() {
|
||||||
BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
|
BMessage msg(BAPP_WINDOW_CLOSE_REQUESTED);
|
||||||
_PostWindowEvent(msg);
|
_PostWindowEvent(msg);
|
||||||
|
|
||||||
/* We won't allow a quit unless asked by DestroyWindow() */
|
/* We won't allow a quit unless asked by DestroyWindow() */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -235,8 +234,8 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
_PostWindowEvent(msg);
|
_PostWindowEvent(msg);
|
||||||
|
|
||||||
/* Before the window zooms, record its size */
|
/* Before the window zooms, record its size */
|
||||||
if( !prev_frame )
|
if( !_prev_frame )
|
||||||
prev_frame = new BRect(Frame());
|
_prev_frame = new BRect(Frame());
|
||||||
|
|
||||||
/* Perform normal hook operations */
|
/* Perform normal hook operations */
|
||||||
BDirectWindow::Zoom(origin, width, height);
|
BDirectWindow::Zoom(origin, width, height);
|
||||||
|
@ -244,19 +243,19 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
|
|
||||||
/* Member functions */
|
/* Member functions */
|
||||||
virtual void Show() {
|
virtual void Show() {
|
||||||
BDirectWindow::Show();
|
while(IsHidden()) {
|
||||||
|
BDirectWindow::Show();
|
||||||
|
}
|
||||||
_shown = true;
|
_shown = true;
|
||||||
|
|
||||||
BMessage msg(BAPP_SHOW);
|
BMessage msg(BAPP_SHOW);
|
||||||
_PostWindowEvent(msg);
|
_PostWindowEvent(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Hide() {
|
virtual void Hide() {
|
||||||
/* FIXME: Multiple hides require multiple shows to undo. Should
|
|
||||||
this be altered to prevent this from happening? */
|
|
||||||
BDirectWindow::Hide();
|
BDirectWindow::Hide();
|
||||||
_shown = false;
|
_shown = false;
|
||||||
|
|
||||||
BMessage msg(BAPP_HIDE);
|
BMessage msg(BAPP_HIDE);
|
||||||
_PostWindowEvent(msg);
|
_PostWindowEvent(msg);
|
||||||
}
|
}
|
||||||
|
@ -273,7 +272,6 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
/* BView message interruption */
|
/* BView message interruption */
|
||||||
virtual void DispatchMessage(BMessage * msg, BHandler * target)
|
virtual void DispatchMessage(BMessage * msg, BHandler * target)
|
||||||
{
|
{
|
||||||
|
|
||||||
BPoint where; /* Used by mouse moved */
|
BPoint where; /* Used by mouse moved */
|
||||||
int32 buttons; /* Used for mouse button events */
|
int32 buttons; /* Used for mouse button events */
|
||||||
int32 key; /* Used for key events */
|
int32 key; /* Used for key events */
|
||||||
|
@ -326,11 +324,6 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
_KeyEvent(key, SDL_RELEASED);
|
_KeyEvent(key, SDL_RELEASED);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _UPDATE_:
|
|
||||||
case _UPDATE_IF_NEEDED_: /* Hopefully one doesn't call the other */
|
|
||||||
_RepaintEvent();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* move it after switch{} so it's always handled
|
/* move it after switch{} so it's always handled
|
||||||
|
@ -341,6 +334,7 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
//BDirectWindow::DispatchMessage(msg, target);
|
//BDirectWindow::DispatchMessage(msg, target);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BDirectWindow::DispatchMessage(msg, target);
|
BDirectWindow::DispatchMessage(msg, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,22 +382,22 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
/* Accessor methods */
|
/* Accessor methods */
|
||||||
bool IsShown() { return _shown; }
|
bool IsShown() { return _shown; }
|
||||||
int32 GetID() { return _id; }
|
int32 GetID() { return _id; }
|
||||||
void LockBuffer() { buffer_locker->Lock(); }
|
void LockBuffer() { _buffer_locker->Lock(); }
|
||||||
void UnlockBuffer() { buffer_locker->Unlock(); }
|
void UnlockBuffer() { _buffer_locker->Unlock(); }
|
||||||
uint32 GetRowBytes() { return row_bytes; }
|
uint32 GetRowBytes() { return _row_bytes; }
|
||||||
int32 GetFbX() { return _bounds.left; }
|
int32 GetFbX() { return _bounds.left; }
|
||||||
int32 GetFbY() { return _bounds.top; }
|
int32 GetFbY() { return _bounds.top; }
|
||||||
int32 GetFbHeight() { return _bounds.bottom - _bounds.top + 1; }
|
int32 GetFbHeight() { return _bounds.bottom - _bounds.top + 1; }
|
||||||
int32 GetFbWidth() { return _bounds.right - _bounds.left + 1; }
|
int32 GetFbWidth() { return _bounds.right - _bounds.left + 1; }
|
||||||
bool ConnectionEnabled() { return !connection_disabled; }
|
bool ConnectionEnabled() { return !_connection_disabled; }
|
||||||
bool Connected() { return _connected; }
|
bool Connected() { return _connected; }
|
||||||
clipping_rect *GetClips() { return _clips; }
|
clipping_rect *GetClips() { return _clips; }
|
||||||
int32 GetNumClips() { return num_clips; }
|
int32 GetNumClips() { return _num_clips; }
|
||||||
uint8* GetBufferPx() { return _bits; }
|
uint8* GetBufferPx() { return _bits; }
|
||||||
int32 GetBytesPerPx() { return bytes_per_px; }
|
int32 GetBytesPerPx() { return _bytes_per_px; }
|
||||||
void SetWindowFramebuffer(uint8* fb) { window_buffer = fb; }
|
void SetWindowFramebuffer(uint8* fb) { _window_buffer = fb; }
|
||||||
uint8* GetWindowFramebuffer() { return window_buffer; }
|
uint8* GetWindowFramebuffer() { return _window_buffer; }
|
||||||
bool CanTrashWindowBuffer() { return trash_window_buffer; }
|
bool CanTrashWindowBuffer() { return _trash__window_buffer; }
|
||||||
|
|
||||||
/* Setter methods */
|
/* Setter methods */
|
||||||
void SetID(int32 id) { _id = id; }
|
void SetID(int32 id) { _id = id; }
|
||||||
|
@ -413,14 +407,14 @@ printf(__FILE__": %d; Direct start.\n", __LINE__);
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL
|
||||||
virtual void SwapBuffers(void)
|
virtual void SwapBuffers(void)
|
||||||
{
|
{
|
||||||
SDL_GLView->UnlockGL();
|
_SDL_GLView->UnlockGL();
|
||||||
SDL_GLView->LockGL();
|
_SDL_GLView->LockGL();
|
||||||
SDL_GLView->SwapBuffers();
|
_SDL_GLView->SwapBuffers();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
virtual BView *View(void)
|
virtual BView *View(void)
|
||||||
{
|
{
|
||||||
return (the_view);
|
return (_the_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,27 +428,26 @@ private:
|
||||||
void _MouseMotionEvent(BPoint &where, int32 transit) {
|
void _MouseMotionEvent(BPoint &where, int32 transit) {
|
||||||
if(transit == B_EXITED_VIEW) {
|
if(transit == B_EXITED_VIEW) {
|
||||||
/* Change mouse focus */
|
/* Change mouse focus */
|
||||||
if(mouse_focused) {
|
if(_mouse_focused) {
|
||||||
_MouseFocusEvent(false);
|
_MouseFocusEvent(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
static int x = 0, y = 0;
|
static int x = 0, y = 0;
|
||||||
/* Change mouse focus */
|
/* Change mouse focus */
|
||||||
if (!mouse_focused) {
|
if (!_mouse_focused) {
|
||||||
_MouseFocusEvent(true);
|
_MouseFocusEvent(true);
|
||||||
}
|
}
|
||||||
// GetXYOffset(x, y); //FIXME: What is this doing? (from SDL 1.2)
|
|
||||||
BMessage msg(BAPP_MOUSE_MOVED);
|
BMessage msg(BAPP_MOUSE_MOVED);
|
||||||
msg.AddInt32("dx", where.x - x);
|
msg.AddInt32("dx", where.x - x);
|
||||||
msg.AddInt32("dy", where.y - y);
|
msg.AddInt32("dy", where.y - y);
|
||||||
x = (int) where.x;
|
x = (int) where.x;
|
||||||
y = (int) where.y;
|
y = (int) where.y;
|
||||||
_PostWindowEvent(msg);
|
_PostWindowEvent(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MouseFocusEvent(bool focusGained) {
|
void _MouseFocusEvent(bool focusGained) {
|
||||||
mouse_focused = focusGained;
|
_mouse_focused = focusGained;
|
||||||
BMessage msg(BAPP_MOUSE_FOCUS);
|
BMessage msg(BAPP_MOUSE_FOCUS);
|
||||||
msg.AddBool("focusGained", focusGained);
|
msg.AddBool("focusGained", focusGained);
|
||||||
_PostWindowEvent(msg);
|
_PostWindowEvent(msg);
|
||||||
|
@ -465,7 +458,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void _MouseButtonEvent(int32 buttons) {
|
void _MouseButtonEvent(int32 buttons) {
|
||||||
int32 buttonStateChange = buttons ^ last_buttons;
|
int32 buttonStateChange = buttons ^ _last_buttons;
|
||||||
|
|
||||||
/* Make sure at least one button has changed state */
|
/* Make sure at least one button has changed state */
|
||||||
if( !(buttonStateChange) ) {
|
if( !(buttonStateChange) ) {
|
||||||
|
@ -486,7 +479,7 @@ private:
|
||||||
B_PRIMARY_MOUSE_BUTTON);
|
B_PRIMARY_MOUSE_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
last_buttons = buttons;
|
_last_buttons = buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _SendMouseButton(int32 button, int32 state) {
|
void _SendMouseButton(int32 button, int32 state) {
|
||||||
|
@ -561,9 +554,9 @@ private:
|
||||||
Minimize(false);
|
Minimize(false);
|
||||||
} else if(IsHidden()) {
|
} else if(IsHidden()) {
|
||||||
Show();
|
Show();
|
||||||
} else if(prev_frame != NULL) { /* Zoomed */
|
} else if(_prev_frame != NULL) { /* Zoomed */
|
||||||
MoveTo(prev_frame->left, prev_frame->top);
|
MoveTo(_prev_frame->left, _prev_frame->top);
|
||||||
ResizeTo(prev_frame->Width(), prev_frame->Height());
|
ResizeTo(_prev_frame->Width(), _prev_frame->Height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,29 +572,29 @@ private:
|
||||||
|
|
||||||
/* Members */
|
/* Members */
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL
|
||||||
BGLView * SDL_GLView;
|
BGLView * _SDL_GLView;
|
||||||
#endif
|
#endif
|
||||||
BView *the_view;
|
BView *_the_view;
|
||||||
|
|
||||||
int32 last_buttons;
|
int32 _last_buttons;
|
||||||
int32 _id; /* Window id used by SDL_BApp */
|
int32 _id; /* Window id used by SDL_BApp */
|
||||||
bool mouse_focused; /* Does this window have mouse focus? */
|
bool _mouse_focused; /* Does this window have mouse focus? */
|
||||||
bool _shown;
|
bool _shown;
|
||||||
bool inhibit_resize;
|
bool _inhibit_resize;
|
||||||
|
|
||||||
BRect *prev_frame; /* Previous position and size of the window */
|
BRect *_prev_frame; /* Previous position and size of the window */
|
||||||
|
|
||||||
/* Framebuffer members */
|
/* Framebuffer members */
|
||||||
bool _connected, connection_disabled;
|
bool _connected, _connection_disabled;
|
||||||
uint8 *_bits;
|
uint8 *_bits;
|
||||||
uint32 row_bytes;
|
uint32 _row_bytes;
|
||||||
clipping_rect _bounds;
|
clipping_rect _bounds;
|
||||||
BLocker *buffer_locker;
|
BLocker *_buffer_locker;
|
||||||
clipping_rect *_clips;
|
clipping_rect *_clips;
|
||||||
int32 num_clips;
|
int32 _num_clips;
|
||||||
int32 bytes_per_px;
|
int32 _bytes_per_px;
|
||||||
uint8 *window_buffer; /* A copy of the window buffer */
|
uint8 *_window_buffer; /* A copy of the window buffer */
|
||||||
bool trash_window_buffer;
|
bool _trash__window_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,20 +118,19 @@ static inline void BE_BDisplayModeToSdlDisplayMode(display_mode *bmode,
|
||||||
/* Later, there may be more than one monitor available */
|
/* Later, there may be more than one monitor available */
|
||||||
void BE_AddDisplay(BScreen *screen) {
|
void BE_AddDisplay(BScreen *screen) {
|
||||||
SDL_VideoDisplay display;
|
SDL_VideoDisplay display;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1, sizeof(SDL_DisplayMode));
|
||||||
display_mode bmode;
|
display_mode bmode;
|
||||||
screen->GetMode(&bmode);
|
screen->GetMode(&bmode);
|
||||||
|
|
||||||
BE_BDisplayModeToSdlDisplayMode(&bmode, &mode);
|
BE_BDisplayModeToSdlDisplayMode(&bmode, mode);
|
||||||
|
|
||||||
SDL_zero(display);
|
SDL_zero(display);
|
||||||
display.desktop_mode = mode;
|
display.desktop_mode = *mode;
|
||||||
display.current_mode = mode;
|
display.current_mode = *mode;
|
||||||
SDL_AddVideoDisplay(&display);
|
SDL_AddVideoDisplay(&display);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BE_InitModes(_THIS) {
|
int BE_InitModes(_THIS) {
|
||||||
printf("Init Modes\n");
|
|
||||||
BScreen screen;
|
BScreen screen;
|
||||||
|
|
||||||
/* Save the current display mode */
|
/* Save the current display mode */
|
||||||
|
@ -144,6 +143,7 @@ int BE_InitModes(_THIS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int BE_QuitModes(_THIS) {
|
int BE_QuitModes(_THIS) {
|
||||||
|
printf(__FILE__": %d; Begin quit\n", __LINE__);
|
||||||
/* Restore the previous video mode */
|
/* Restore the previous video mode */
|
||||||
BScreen screen;
|
BScreen screen;
|
||||||
display_mode *savedMode = _GetBeApp()->GetPrevMode();
|
display_mode *savedMode = _GetBeApp()->GetPrevMode();
|
||||||
|
@ -163,10 +163,9 @@ int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
|
void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
|
||||||
printf("Get Display Modes\n");
|
|
||||||
/* Get the current screen */
|
/* Get the current screen */
|
||||||
BScreen bscreen;
|
BScreen bscreen;
|
||||||
|
|
||||||
/* Iterate through all of the modes */
|
/* Iterate through all of the modes */
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
display_mode this_bmode;
|
display_mode this_bmode;
|
||||||
|
@ -188,7 +187,6 @@ void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
|
int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
|
||||||
printf("Set Display Modes\n");
|
|
||||||
/* Get the current screen */
|
/* Get the current screen */
|
||||||
BScreen bscreen;
|
BScreen bscreen;
|
||||||
|
|
||||||
|
@ -212,7 +210,7 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(!bwin->Connected()) { snooze(1600); }
|
while(!bwin->Connected()) { snooze(10); }
|
||||||
|
|
||||||
/* Make sure we have exclusive access to frame buffer data */
|
/* Make sure we have exclusive access to frame buffer data */
|
||||||
bwin->LockBuffer();
|
bwin->LockBuffer();
|
||||||
|
@ -228,7 +226,6 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
|
||||||
|
|
||||||
/* Create a copy of the pixel buffer if it doesn't recycle */
|
/* Create a copy of the pixel buffer if it doesn't recycle */
|
||||||
*pixels = bwin->GetWindowFramebuffer();
|
*pixels = bwin->GetWindowFramebuffer();
|
||||||
printf(__FILE__": %d; window frame buffer make\n", __LINE__);
|
|
||||||
if( bwin->CanTrashWindowBuffer() || (*pixels) == NULL) {
|
if( bwin->CanTrashWindowBuffer() || (*pixels) == NULL) {
|
||||||
if( (*pixels) != NULL ) {
|
if( (*pixels) != NULL ) {
|
||||||
SDL_free(*pixels);
|
SDL_free(*pixels);
|
||||||
|
@ -236,11 +233,6 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
|
||||||
*pixels = SDL_calloc((*pitch) * bwin->GetFbHeight() *
|
*pixels = SDL_calloc((*pitch) * bwin->GetFbHeight() *
|
||||||
bwin->GetBytesPerPx(), sizeof(uint8));
|
bwin->GetBytesPerPx(), sizeof(uint8));
|
||||||
bwin->SetWindowFramebuffer((uint8*)(*pixels));
|
bwin->SetWindowFramebuffer((uint8*)(*pixels));
|
||||||
if(*pixels) {
|
|
||||||
printf(__FILE__": %d; Success!\n", __LINE__);
|
|
||||||
} else {
|
|
||||||
printf(__FILE__": %d; FAIL!\n", __LINE__);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bwin->UnlockBuffer();
|
bwin->UnlockBuffer();
|
||||||
|
@ -283,7 +275,7 @@ int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
|
||||||
clips[i].top * bufferPitch + clips[i].left * BPP;
|
clips[i].top * bufferPitch + clips[i].left * BPP;
|
||||||
windowpx = windowBaseAddress +
|
windowpx = windowBaseAddress +
|
||||||
clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
|
clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
|
||||||
printf(__FILE__": %d\n\twindowpx = 0x%x\n\tbufferpx = 0x%x\n\twindowPitch = %i\n\tbufferPitch = %i\n", __LINE__, windowpx, bufferpx, windowPitch, bufferPitch);
|
|
||||||
/* Copy each row of pixels from the window buffer into the frame
|
/* Copy each row of pixels from the window buffer into the frame
|
||||||
buffer */
|
buffer */
|
||||||
for(y = 0; y < height; ++y)
|
for(y = 0; y < height; ++y)
|
||||||
|
|
|
@ -37,25 +37,25 @@ static inline SDL_BApp *_GetBeApp() {
|
||||||
return ((SDL_BApp*)be_app);
|
return ((SDL_BApp*)be_app);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _InitWindow(_THIS, SDL_Window *window) {printf("SDL_bwindow.cc: 40\n");
|
int _InitWindow(_THIS, SDL_Window *window) {
|
||||||
BRect bounds(
|
BRect bounds(
|
||||||
window->x,
|
window->x,
|
||||||
window->y,
|
window->y,
|
||||||
window->x + window->w - 1, //BeWindows have an off-by-one px w/h thing
|
window->x + window->w - 1, //BeWindows have an off-by-one px w/h thing
|
||||||
window->y + window->h - 1
|
window->y + window->h - 1
|
||||||
);
|
);
|
||||||
printf("SDL_bwindow.cc: 30\n");
|
|
||||||
SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds);
|
SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds);
|
||||||
if(bwin == NULL)
|
if(bwin == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
printf("SDL_bwindow.cc: 51\n");
|
|
||||||
window->driverdata = bwin;
|
window->driverdata = bwin;
|
||||||
int32 winID = _GetBeApp()->GetID(window);
|
int32 winID = _GetBeApp()->GetID(window);
|
||||||
bwin->SetID(winID);
|
bwin->SetID(winID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BE_CreateWindow(_THIS, SDL_Window *window) {printf("SDL_bwindow.cc: 58\n");
|
int BE_CreateWindow(_THIS, SDL_Window *window) {
|
||||||
if(_InitWindow(_this, window) == ENOMEM)
|
if(_InitWindow(_this, window) == ENOMEM)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue