arc.window

Window module allows access to the game window .

Authors:
ArcLib team, see AUTHORS file

Maintainer:
Clay Smith (clayasaurus at gmail dot com)

License:
zlib/libpng license:

Description:
Window allows opening and closing of window with user given parameters. Window also contains code to take a screenshot of itself, retrieve its dimensions, resize itself and alter its coordinate system.

Examples:
	import arc.window;

	int main()
	{
		// initialize SDL/OpenGL window
		// read window parameters from a lua configuration file
		arc.window.open("Title", width, height, bFullScreen);

		// take a screenshot of current window and save it as a bitmap
		arc.window.screenshot("screen1");

		// toggle between full screen and window mode (linux only)
		arc.window.toggleFullScreen();

		// resize window with given width and height (currently texture information is lost on Windows)
		arc.window.resize(width, height)

		// get window's height and width
		arc.window.getHeight/getWidth;

		while (gameloop)
		{
			// clear contents of window
			arc.window.clear();

			// draw stuff to the screen

			// switch to next window frame
			arc.window.swap();
		}

		// closes the window
		arc.window.close();

	   return 0;
	}


void open (char[] argTitle, int argWidth, int argHeight, bool argFullscreen);
Opens a window with the given size and initializes OpenGL

void close ();
Close SDL window and delete the screen

int getWidth ();
Returns window width

int getHeight ();
Returns window height

Size getSize ();
returns window size

bool isFullScreen ();
Returns true if window is fullscreen

SDL_Surface * getScreen ();
get the window screen

void resize (int argWidth, int argHeight);
Resize window to desired width and height

void toggleFullScreen ();
Toggle between fullscreen and windowed mode; linux only

void clear ();
clear the screen

void swap ();
swap the screen buffers and clear the screen

void swapClear ();
swap and clear the screen

void screenshot (char[] argName);
Captures a screenshot and saves in BMP format to current directory

struct coordinates ;
Offers functionality for dealing with the coordinate system.

By default the origin (0,0) is in the top-left corner, x faces right, y down. By default, the bottom-right corner has the coordinates (800,600).

This is mainly intended to allow the customization of the coordinate system at startup and on window resizes.

It is not recommended to use this for scrolling: since these functions alter the global coordinate system, you will have no control over what scrolls and what doesn't. Use the scenegraph with a Transform node for selective scrolling.

static void setSize (Size argsize);
sets the virtual size of the screen

static void setOrigin (Point argorigin);
sets the coordinates for the top-left corner of the screen

static Size getSize ();
static float getWidth ();
static float getHeight ();
gets the virtual screen size

static Point getOrigin ();
gets the coordinates of the top-left corner of the screen

Page was generated with on Mon Jul 16 17:24:36 2007