Commit graph

243 commits

Author SHA1 Message Date
Sam Lantinga
a4231ad5d8 Support the new 16-bit pixel formats in SDL_CreateTextureFromSurface() 2011-01-12 15:22:29 -08:00
Sam Lantinga
835dde1a18 You can't change the resolution on some devices 2011-01-12 13:46:37 -08:00
Sam Lantinga
9ec38356d0 Use a valid window when creating the default renderer 2011-01-12 13:38:10 -08:00
Sam Lantinga
35cc558917 Use the enumerated type for blend and scale mode instead of int
Renamed SDL_TextureScaleMode to SDL_ScaleMode
2010-12-12 15:19:05 -08:00
Daniel Wyatt
423b30c5df Windows candidate list support.
Candidate list should now be drawn and function normally.
Tested in XP and 7.
2010-11-23 17:46:47 -05:00
Sam Lantinga
51b19abe02 Minor cleanup in patches from Coursoud 2010-09-27 01:30:42 -07:00
Sam Lantinga
45e68f6c5c Merged the Windows custom window system hooks into the union used by X11.
Added Cocoa custom window system hooks
2010-09-27 01:24:05 -07:00
Sam Lantinga
bbf3279972 SDL_DestroyWindow is setting window->magic to NULL too early. -
window->magic is also checked in SDL_DestroyRenderer. All cleanup code
like freeing the renderer and textures is not executed.
The patch moves window_magic = NULL behind the SDL_DestroyRenderer call.

Kind regards,

André
2010-09-27 00:49:34 -07:00
Sam Lantinga
4d97d1a549 Whoops, return "" even if the window is invalid. 2010-08-29 16:28:04 -07:00
Sam Lantinga
b59ef043a6 The title is stored internally as NULL if it's empty, and returned as "" 2010-08-29 16:26:35 -07:00
Sam Lantinga
a64fc29cfb Merged Paul's Google Summer of Code work from SDL-gsoc2010_android 2010-08-22 12:23:55 -07:00
Sam Lantinga
8d14ec12cc Andrey A.
I made a video driver GAPI/RAW for WinCE (SDL-1.3).
RAW mode has a priority, and also, GAPI mode works with environment
"SDL_VIDEO_RENDERER=gapi" and for RAW mode "SDL_VIDEO_RENDERER=raw".

I checked the work on the screens of VGA, WVGA, QVGA, WQVGA, HVGA,
 + tested all modes with WindowsMobile Emulator.

Also, correctly draws the pointer position and the scale of the pointer
for VGA/WVGA modes,
correctly draws top left position for DM orientation screen, and
portrait/landscape/square geometry the screen also correct.

Also, I added a small fix for GDI fullscreen mode.

Patch for latest revision SDL-1.3 in an attachment.
Also added small path for mingw32ce build.
2010-07-27 21:31:28 -07:00
Sam Lantinga
43503a8b99 Fixed bug #1000
Don't crash if someone tries to delete a context after we've unloaded the library.  In this case it's SDL_compat that doesn't know SDL_VideoQuit() has been called.  Hmm...
2010-07-14 07:48:35 -07:00
Sam Lantinga
c2c15058b1 Simplified clipboard API for sanity's sake.
A complete clipboard implementation would support multiple formats that could be queried at runtime, events for when the clipboard contents changed, support for HTML, images, etc.  We're not going that crazy, at least for now. :)
2010-07-07 23:54:03 -07:00
Sam Lantinga
95fbd50b15 Mostly cleaned up warnings with -Wmissing-prototypes 2010-06-26 08:56:48 -07:00
Paul Hunkin
dc9ee5ef88 Added (partially implemented) android video backend and associated files needed to build 2010-06-10 18:54:23 +12:00
Sam Lantinga
6f34ceab02 Fixed bug 984
SDL_CreateTexture allows the creation of textures of size 0, which can lead to div by 0 errors
2010-04-15 21:27:32 -07:00
Sam Lantinga
db2e29b2d0 Fixed showing and hiding fullscreen windows
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404457
2010-02-01 01:19:37 +00:00
Sam Lantinga
4d3df8b3e3 Fixed bug #926
Updated copyright to LGPL version 2.1 and year 2010

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404453
2010-01-24 21:10:53 +00:00
Sam Lantinga
73074be94a Added magic to detect already freed or otherwise invalid windows and textures.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404451
2010-01-24 20:21:51 +00:00
Sam Lantinga
80a88bc0d3 Fixed bug #916
Shutting down the video shuts down the event loop, so don't do that after starting the event loop. :)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404449
2010-01-24 19:47:17 +00:00
Sam Lantinga
51c2d1714d update window prev links
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404446
2010-01-22 16:17:11 +00:00
Sam Lantinga
8bd993e9e1 Fixed infinite loop at shutdown - update texture prev links
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404445
2010-01-22 15:55:20 +00:00
Sam Lantinga
218618259e Fixed compile warning
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404439
2010-01-21 07:10:22 +00:00
Sam Lantinga
a0e019f786 Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404438
2010-01-21 06:21:52 +00:00
Sam Lantinga
37d1b35d66 From: Jjgod Jiang
Date: Mon, 18 Jan 2010 17:46:35 +0800
Subject: [PATCH] Polish text input handling for Mac OS X

- Prevent crash caused by uninitialized video data
- Prevent beeping caused by unhandled Cocoa selectors (like moveUp:
  moveDown:, etc.)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404436
2010-01-19 07:28:51 +00:00
Sam Lantinga
e84dac760c Fixed bug #930
The PS2 video driver is obsolete and not going to be updated unless someone wants to maintain it.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404431
2010-01-18 14:27:30 +00:00
Sam Lantinga
b9702243c7 Removed in the interest of actually finishing 1.3. :)
They can be done later, either by me or by someone else.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404353
2009-12-30 19:10:41 +00:00
Sam Lantinga
b393d088e8 Updated to compile on Windows
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404349
2009-12-24 19:18:05 +00:00
Sam Lantinga
6da163ab81 Added SDL_RenderClear() as a fast method of clearing the screen to the drawing color.
Renamed SDL_RenderPoint() and SDL_RenderLine() to SDL_RenderDrawPoint() and SDL_RenderDrawLine().
Added API for rectangle drawing (as opposed to filling)
Added placeholder API functions for circles and ellipses ... I'm not sure whether these will stay.
Optimized software line drawing quite a bit.
Added support for Wu's anti-aliased line drawing, currently disabled by default.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404346
2009-12-23 01:55:00 +00:00
Sam Lantinga
240b5fcaab Default to allow either accelerated or not
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404320
2009-12-15 20:53:09 +00:00
Sam Lantinga
fe2b42f86c OpenGL hardware acceleration defaults on
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404319
2009-12-15 20:36:31 +00:00
Sam Lantinga
4672f074e0 Fixed constness in RenderRects() parameter
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404284
2009-12-11 09:13:51 +00:00
Sam Lantinga
8ee9720297 Added interfaces for batch drawing of points, lines and rects:
SDL_DrawPoints()
    SDL_BlendPoints()
    SDL_BlendLines()
    SDL_DrawLines()
    SDL_FillRects()
    SDL_BlendRects()
    SDL_RenderPoints()
    SDL_RenderLines()
    SDL_RenderRects()
Renamed SDL_RenderFill() to SDL_RenderRect()

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404279
2009-12-09 15:56:56 +00:00
Sam Lantinga
52f2433c29 Added an API function to query geometry of multiple monitors:
SDL_GetDisplayBounds()

Implemented multi-monitor window positions on Windows

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404271
2009-12-06 08:03:38 +00:00
Sam Lantinga
656ee60af0 Fixed compiler warnings
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404269
2009-12-05 22:13:36 +00:00
Sam Lantinga
e12e0c04d3 Fixed mouse events for fullscreen windows on Mac OS X
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404260
2009-12-03 08:33:39 +00:00
Sam Lantinga
013a718a1f Restore the video mode after shutting down the renderer, which fixes an error deleting the OpenGL context on Mac OS X.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404259
2009-12-03 05:05:26 +00:00
Sam Lantinga
ae0f3ac642 If we're fullscreen on a single-head system and lose focus, minimize
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404253
2009-12-02 07:42:10 +00:00
Sam Lantinga
e4f2557276 On multi-display systems it's perfectly reasonable to have focus on a window on another monitor while the application is fullscreen.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404252
2009-12-02 07:38:28 +00:00
Sam Lantinga
eac4a9bf35 Explicitly clear fullscreen status rather than relying on the window focus behavior.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404244
2009-12-01 09:04:28 +00:00
Sam Lantinga
b98089ee2a Whenever a window becomes fullscreen, shown, unminimized, and has input focus it will change the display to the corresponding fullscreen video mode.
If it loses any of those properties the desktop mode will be restored.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404243
2009-12-01 08:56:12 +00:00
Sam Lantinga
c77842705f Removed a little redundancy in the naming
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404242
2009-12-01 06:15:10 +00:00
Sam Lantinga
1cd715e9db Work in progress on multi-display support:
* Added display parameter to many internal functions so video modes can be set on displays that aren't the public current one.
* The fullscreen mode is associated with fullscreen windows - not displays, so different windows more naturally have a mode associated with them based on their width and height.  It's no longer necessary to specify a fullscreen mode, a default one will be picked automatically for fullscreen windows.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404241
2009-12-01 05:57:15 +00:00
Mike Gorchak
feffe12108 Override renderer for OpenGL window, only in case if OpenGL or OpenGL ES renderers are enabled.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404230
2009-11-24 19:28:27 +00:00
Sam Lantinga
e7553b2ddc Fixed bug #771
Cleaned up the code a bit and made sure that an OpenGL window gets the OpenGL
renderer.  Inspired by a patch from Mason Wheeler.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404229
2009-11-24 16:43:18 +00:00
Sam Lantinga
56425cc2d3 Fixed bug #891
Mason Wheeler      2009-11-23 06:59:48 PST

There's code in SDL_RecreateWindow specifically to handle SDL_WINDOW_FOREIGN,
but it appears to have been overlooked in the allowed_flags constant.  This
causes the line

    window->flags = (flags & allowed_flags);

to strip SDL_WINDOW_FOREIGN from the window's flags, which breaks some code in
WIN_WindowProc in SDL_win32Events.c that treats foreign windows differently.
This can be trivially fixed by defining allowed_flags as

    const Uint32 allowed_flags = (SDL_WINDOW_FULLSCREEN |
                                  SDL_WINDOW_OPENGL |
                                  SDL_WINDOW_BORDERLESS |
                                  SDL_WINDOW_RESIZABLE |
                                  SDL_WINDOW_INPUT_GRABBED |
                                  SDL_WINDOW_FOREIGN);

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404227
2009-11-24 04:59:50 +00:00
Sam Lantinga
b7844cd95f Mason Wheeler to sdl
I updated SDL, and suddenly my SDL frames stopped working.  They'd "initialize" full of gibberish, and I couldn't render anything to them.  After a bit of digging, I found a problem: the renderer initialization routine in my SDL frame code wasn't getting called anymore.

procedure TSdlFrame.Paint;
begin
   if SDL_SelectRenderer(FWindowID) = -1 then
      CreateRenderer;
   SDL_RenderPresent;
end;

function TSdlFrame.CreateRenderer: boolean;
const
   pf: tagPIXELFORMATDESCRIPTOR = (nSize: sizeof(pf); nVersion: 1;
       dwFlags: PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER;
       iPixelType: PFD_TYPE_RGBA; cColorBits: 24; cAlphaBits: 8;
       iLayerType: PFD_MAIN_PLANE);

   RENDERERS: array[TRendererType] of AnsiString = ('software', 'gdi', 'opengl', 'd3d');
var
  pFormat: integer;
begin
   if (SDL_SelectRenderer(FWindowID) = 0) then
   begin
      result := true;
      Exit;
   end;
   if FRendererType = rtOpenGL then
   begin
      pFormat := ChoosePixelFormat(canvas.Handle, @pf);
      if not SetPixelFormat(canvas.Handle, pFormat, @pf) then
         outputDebugString(PChar(SysErrorMessage(GetLastError)));
      if wglCreateContext(canvas.Handle) = 0 then
         outputDebugString(PChar(SysErrorMessage(GetLastError)));
   end;
   if (SDL_CreateRenderer(FWindowID, SDL_RendererIndex(RENDERERS[FRendererType]), [sdlrPresentFlip3, sdlrAccelerated]) = 0) then
   begin
      SDL_ShowWindow(FWindowID);
      assert(SDL_SetRenderDrawColor(0, 0, 0, 255) = 0);
      FFlags := SDL_GetWindowFlags(FWindowID);
      if assigned(FOnAvailable) then
         FOnAvailable(self);
   end
   else outputDebugString(pChar(format('SDL_CreateRenderer failed: %s', [sdl_GetError])));
   result := SDL_SelectRenderer(FWindowID) = 0;
end;

This is a critical issue.  The Paint method gets called when the control receives a WM_PAINT message from Windows.  I can't create the renderer before then, or it will fail and cause trouble.  And when I do create it, it needs to be created with certain parameters.  So imagine my surprise when I started debugging into the DLL and found that SDL_SelectRenderer was trying to be "helpful" by creating the renderer for me if it didn't already exist!  Now not only does my initialization code not get called, I end up with the wrong renderer and so things don't render as expected when I try to use the window.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404226
2009-11-24 04:48:12 +00:00
Sam Lantinga
6e102beb88 Don't add the OpenGL renderers for drivers that don't support OpenGL
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404191
2009-11-18 09:17:29 +00:00
Sam Lantinga
9e98b7ad9e If we explicitly request a driver, try to initialize it.
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404189
2009-11-18 08:54:13 +00:00