Files
haiku-beta6/docs/user/game/DirectWindow.dox
T

374 lines
7.4 KiB
Plaintext
Raw Normal View History

2012-12-21 20:37:55 -05:00
/*
* Copyright 2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* John Scipione, [email protected]
*
* Corresponds to:
* src/kits/game/DirectWindow.cpp hrev45044
* src/kits/game/DirectWindow.h hrev45044
*/
/*!
\file DirectWindow.h
2013-02-06 21:05:00 -05:00
\ingroup game
\ingroup libbe
\brief Provides the BDirectWindow class.
2012-12-21 20:37:55 -05:00
*/
/*!
\enum direct_buffer_state
2013-02-06 21:05:00 -05:00
2012-12-21 21:01:40 -05:00
Direct buffer state constants
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\enum direct_driver_state
2013-02-06 21:05:00 -05:00
2012-12-21 21:01:40 -05:00
Direct driver state constants
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\struct direct_buffer_info
2013-02-06 21:05:00 -05:00
\ingroup game
\ingroup libbe
2012-12-21 21:01:40 -05:00
Direct butter info struct
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\var direct_buffer_info::buffer_state
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
State of the direct buffer access privileges.
It can have one of the following values:
- \c B_DIRECT_MODE_MASK
- \c B_DIRECT_START
- \c B_DIRECT_MODIFY
- \c B_DIRECT_STOP
- \c B_BUFFER_MOVED
- \c B_BUFFER_RESET
- \c B_BUFFER_RESIZED
- \c B_CLIPPING_MODIFIED
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\var direct_buffer_info::driver_state
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
State of the graphics card on which your direct window is displayed.
There are two possible values:
2013-02-06 21:05:00 -05:00
- \c B_MODE_CHANGED The resolution or color depth has changed.
- \c B_DRIVER_CHANGED The window was moved onto another monitor.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\var direct_buffer_info::bits
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Pointer to the frame buffer in your team's memory space.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\var direct_buffer_info::pci_bits
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Pointer to the frame buffer in the PCI memory space. This value is
typically needed to control DMA.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2014-06-11 16:45:07 -04:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::bytes_per_row
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Number of bytes used to represent a single row of pixels in the frame buffer.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\var direct_buffer_info::bits_per_pixel
2013-02-06 21:05:00 -05:00
Number of bits actually used to store a single pixel, including reserved,
2012-12-21 20:37:55 -05:00
unused, or alpha channel bits. This value is usually a multiple of eight.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\var direct_buffer_info::pixel_format
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
The format used to encode a pixel as defined by the \c color_space type.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::layout
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Reserved for future use.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::orientation
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Reserved for future use.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::_reserved[9]
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Reserved for future use.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::_dd_type_
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Reserved for future use.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::_dd_token_
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Reserved for future use.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::clip_list_count
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Number of rectangles in \c clip_list.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::window_bounds
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Rectangle that defines the full content area of the window in screen
coordinates.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
/*!
\var direct_buffer_info::clip_bounds
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
Bounding rectangle of the visible part of the content area of the window
in screen coordinates.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\var direct_buffer_info::clip_list
2013-02-06 21:05:00 -05:00
2012-12-21 20:37:55 -05:00
List of rectangles that together define the visible region of the content
area of the window in screen coordinates.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
2012-12-21 21:01:40 -05:00
\class BDirectWindow
2012-12-21 20:37:55 -05:00
\ingroup game
\ingroup libbe
\brief Provides direct access to the video card graphics frame buffer.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
2014-06-11 16:45:07 -04:00
\fn BDirectWindow::BDirectWindow(BRect frame, const char* title,
2012-12-21 20:37:55 -05:00
window_type type, uint32 flags, uint32 workspace)
2012-12-21 21:01:40 -05:00
\brief Creates and initializes a BDirectWindow object.
2012-12-21 20:37:55 -05:00
2012-12-21 21:01:40 -05:00
\param frame The initial frame rectangle of the window.
\param title The title of the Window.
\param type Window type (see BWindow).
\param flags Window flags (see BWindow).
\param workspace Workspace of the direct window (see BWindow).
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
2014-06-11 16:45:07 -04:00
\fn BDirectWindow::BDirectWindow(BRect frame, const char* title,
2012-12-21 20:37:55 -05:00
window_look look, window_feel feel, uint32 flags, uint32 workspace)
2012-12-21 21:01:40 -05:00
\brief Creates and initializes a BDirectWindow object.
\param frame The initial frame rectangle of the window.
\param title The title of the Window.
\param look Window look (see BWindow).
\param feel Window feel (see BWindow).
\param flags Window flags (see BWindow).
\param workspace Workspace of the direct window (see BWindow).
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\fn BDirectWindow::~BDirectWindow()
\brief Destroys the BDirectWindow and frees all memory used by it.
Do not delete a BDirectWindow object directly, call Quit() instead.
2012-12-21 21:01:40 -05:00
Destroying a BDirectWindow involves a few steps to make sure that it
is disconnected and cleaned up.
2012-12-21 20:37:55 -05:00
Set the fConnectionDisabled flag to \c true to prevent DirectConnected()
from attempting to reconnect while it's being destroyed.
next call Hide() and finally Sync() to force the direct window to
disconnect from direct access.
2012-12-21 21:01:40 -05:00
Once these steps are complete you may do your usual destructor work.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
2014-06-11 16:45:07 -04:00
\fn BArchivable* BDirectWindow::Instantiate(BMessage* data)
2012-12-21 20:37:55 -05:00
\brief Instantiate window from message \a data. Not implemented.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
2014-06-11 16:45:07 -04:00
\fn status_t BDirectWindow::Archive(BMessage* data, bool deep) const
2012-12-21 20:37:55 -05:00
\brief Archive window into message \a data. Not implemented.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
2014-06-11 16:45:07 -04:00
\fn void BDirectWindow::DirectConnected(direct_buffer_info* info)
\brief Hook method called when your application learns about the state
of the graphics display and changes occur.
2012-12-21 20:37:55 -05:00
This is the heart of BDirectWindow.
\param info The \c direct_buffer_info struct
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
2014-06-11 16:45:07 -04:00
\fn status_t BDirectWindow::GetClippingRegion(BRegion* region,
BPoint* origin) const
2012-12-21 20:37:55 -05:00
\brief Sets \a region to the current clipping region of the direct window.
If \a origin is not \c NULL, the \a region is offset by \a origin.
\warning GetClippingRegion() should only be called from within the
2014-06-11 16:45:07 -04:00
DirectConnected() method. If called outside GetClippingRegion()
will return \c B_ERROR.
2012-12-21 20:37:55 -05:00
\param region The clipping region to fill out.
\param origin An origin to offset the region by.
\returns A status code.
\retval B_OK Everything went as expected.
\retval B_BAD_VALUE \a region was NULL.
\retval B_ERROR Window not locked or not in DirectConnected() method.
\retval B_NO_MEMORY Not enough memory to fill \a region
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\fn status_t BDirectWindow::SetFullScreen(bool enable)
\brief Enables or disables full-screen mode.
The SupportsWindowMode() method determines whether or not the video card
is capable of supporting windowed mode.
When the window is in full screen mode it will always have the focus and
no other window can be in front of it.
\param enable \c true to enable fullscreen mode, \c false for windowed mode.
\returns A status code.
\retval B_OK Everything went as expected.
\retval B_ERROR An error occurred while trying to switch between full screen
2014-06-11 16:45:07 -04:00
and windowed mode.
2012-12-21 20:37:55 -05:00
2012-12-21 21:01:40 -05:00
\see BDirectWindow::SupportsWindowMode()
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\fn bool BDirectWindow::IsFullScreen() const
\brief Returns whether the window is in full-screen or windowed mode.
\returns \c true if in full-screen mode, \c false if in windowed mode.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/
/*!
\fn static bool BDirectWindow::SupportsWindowMode(screen_id id)
\brief Returns whether or not the specified screen supports windowed mode.
Because this is a static function you don't have to construct a
BDirectWindow object to call it.
\param id The id of the screen you want to check, \c B_MAIN_SCREEN_ID by
2014-06-11 16:45:07 -04:00
default.
2012-12-21 20:37:55 -05:00
\returns \c true if the screen support windowed mode, \c false otherwise.
2014-06-11 16:45:07 -04:00
\since BeOS R3
2012-12-21 20:37:55 -05:00
*/