95 Commits

Author SHA1 Message Date
Charles Dang
8732d8179c Added and deployed getter method for current window resolution 2016-01-01 18:29:54 +11:00
Charles Dang
6272190ec5 Restrict CVideo::modePossible to SDL1 only
It's only called from SDL1 functions anyway
2016-01-01 18:29:51 +11:00
Andreas Löf
544b61534c Fix bug #24209 and add a global event scope
This adds a global event scope that an sdl_handler can register to in
order to receive all current events, regardless of the current
scope. Care should be taken to not be registerd in a local event
context and the global context at the same time as it will lead to the
event handler potentially being invoked twice.

This also adds the workaround needed for #24209 in the new event
handler in the video class.
2016-01-01 17:56:59 +13:00
Charles Dang
ccc2433979 Move relevant functions from preferences to display class
This affects window setter functions such as set_fullscreen() and set_resolution()
2015-12-31 14:00:54 +11:00
Charles Dang
136ca10a9a Added DefaultBpp var to CVideo class 2015-12-31 14:00:52 +11:00
Charles Dang
9ac728cef7 Relegate some unneeded Bpp-related functions to SDL1 2015-12-31 14:00:19 +11:00
gfgtdf
6cf73ad76e move unused variables into their ifdefs 2015-12-30 21:17:06 +01:00
Charles Dang
a929397cc0 Removed an additional macro alias for fullscreen 2015-12-30 11:52:26 +11:00
Elvish_Hunter
9b7b1751fd Removed trailing tabs and whitespaces from C++ source
I used this command line: find <source directory> -name \*.\[ch\]pp -print0 | xargs -0 sed -i 's/[[:blank:]]*$//'
2015-12-21 20:39:46 +01:00
Andreas Löf
36456df46f Fixes bug #24138 and disables SDL_PumpEvent() in grid.cpp
This removes the usage of the display::get_singleton() in the event
handling code since it may cause incorrect behaviour (crash) when the
singleton has been incorrectly set to null.

This also removes SDL_PumpEvents() from grid.cpp the rendering code
should not be directly interacting with the event handling and it's
causing instabilities.
2015-12-05 21:12:20 +13:00
Andreas Löf
449aed0a64 Fix Bug #23908 - Crash on resize with SDL2.
SDL2 uses shared memory to communicate with the graphics system when
using a software renderer. A resize event will cause SDL2 to
invalidate the SDL_surface that relies on shared memory and any
subsequent calls to will be SDL_GetWindowSurface will cause the shared
memory do be unmapped as the old surface is released.  This is
problematic when it occurs during a rendering cycle, because the
software rendered may also invoke SDL_GetWindowSurface, making any
references to that surface that the game contains become stale. This
will in turn cause a segmentation fault during blitting.
2015-10-13 01:24:51 +13:00
Andreas Löf
0c27eb9490 Only use references to the screen surface.
This change makes sure that only references are used to the video
surface instead of a copy. This will help to avoid stale values after
a resize event has occured where it will cause a crash due to a stale
pointer.
2015-10-12 23:05:48 +13:00
Ignacio R. Morelle
57ae45387a New Year copyright update 2015-01-01 19:07:35 -03:00
Boldizsár Lipka
d0c30c6ad6 Apply updated overlay instantenously. 2014-08-19 20:43:26 +02:00
Boldizsár Lipka
27a1f195f9 Update overlay when changed. 2014-08-19 20:43:26 +02:00
Boldizsár Lipka
623fd991c3 Draw floating labels to the overlay texture. 2014-08-12 22:46:27 +02:00
Boldizsár Lipka
0b4bfc76db Fix fullscreen mode for SDL_gpu. 2014-08-11 23:01:56 +02:00
Boldizsár Lipka
e2c8957ab6 Implement vertical and horizontal flip and grayscale effects.
Raises required GLSL version to 1.30.
2014-08-11 23:01:55 +02:00
Boldizsár Lipka
888df77e7a Don't limit color modulation to the [-128, 127] range. 2014-08-11 23:01:54 +02:00
Mark de Wever
f62c63ea07 Fix some class/struct tags. 2014-07-29 20:45:10 +02:00
Boldizsár Lipka
b006dac297 Use shaders for color blending in SDL_gpu builds. 2014-07-29 19:04:31 +02:00
Boldizsár Lipka
7d3535645f Rename ttexture to timage. 2014-07-17 21:47:04 +02:00
Boldizsár Lipka
51aeb482a6 Guard CVideo::draw_texture with an ifdef. 2014-07-08 18:30:29 +02:00
Boldizsár Lipka
aeb1f5ea84 Move ttexture::draw calls into CVideo::draw_texture. 2014-07-08 18:10:59 +02:00
Boldizsár Lipka
fba9a360cc Enable OpenGL rendering. 2014-06-27 11:57:49 +02:00
Boldizsár Lipka
d85f74e64d Make the global twindow object globally available.
Note: This is a quick an not really elegant change. I'll fix this as
soon as I'll have figured how CVideo and twindow should relate to
eachother.
2014-06-08 10:58:38 +02:00
Mark de Wever
9de59be3a7 Update the Doxygen comments. 2014-03-09 15:21:31 +01:00
Mark de Wever
08e717e4cd Add a work-around for SDL_WM_SetIcon in SDL2.
The code compiles, but doesn't do anything useful at the moment.
2014-03-02 15:31:17 +01:00
Mark de Wever
c28579e1f1 Add a work-around for SDL_WM_SetCaption in SDL2.
The code compiles, but doesn't do anything useful at the moment.
2014-03-02 15:15:13 +01:00
Mark de Wever
04eea89636 Refactor show_video_mode_dialog.
Separated the dialog code from the resolution gathering code. This makes
it easier to port the code to SDL2.

This also changes the sorting of the resolutions, first width then
height instead of based on the area. Before a part of the list looked
like:
1280 x 720
1152 x 864
1280 x 960
1440 x 900
1282 x 1024
These now look like:
1152 x 864
1280 x 720
1280 x 960
1280 x 1024
1440 x 900
The new sorting makes more sense to me.
2014-03-02 13:11:48 +01:00
Mark de Wever
57432e805f Add a work-around for SDL_GetAppState in SDL2.
The code only compiles, but never return a sensible value. This should
be done later.
2014-03-02 10:56:21 +01:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
Mark de Wever
3d964af76a Remove some unused defines. 2013-03-09 21:24:57 +00:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Karol Nowak
437ee1b853 Fixed a bug with --bpp setting being ignored upon resolution change.
Forcing --bpp still breaks the video mode selection dialog.
2011-06-15 20:54:03 +00:00
Mark de Wever
fe33804d90 Convert quit from stick to jailbreak exception.
The goal is to replace all stikcy exceptions jail break exceptions and
make the exeption handling of Lua a bit more like normal C++ exception
handling.
2011-03-27 20:55:18 +00:00
Mark de Wever
ecbabea838 New year copyright update. 2011-01-01 15:57:50 +00:00
Mark de Wever
c4fc0f897c Remove an unneeded include. 2010-11-21 13:57:02 +00:00
Ignacio R. Morelle
d6a3de1938 Apply patch #2213 by stikonas, using file #11274 2010-11-21 01:56:29 +00:00
Ali El Gariani
c63a7d97ae Improving constness of surface: forbid to blit on a const surface. 2010-10-01 01:43:16 +00:00
Guillaume Melquiond
eeb047de55 Fixed file headers so that they match the content of the COPYING file. 2010-09-01 21:12:38 +00:00
Alexander van Gessel
48ce177759 Made some more errors inherit from game::error 2010-08-03 18:36:59 +01:00
Guillaume Melquiond
0ee3b0a6db Factored the whole exception handling.
Implemented sticky exceptions that can be rethrown at will.

Used them to ensure that quitting the game, loading a new game, and
leaving to title screen, work correctly when WML is being executed.
2010-07-31 10:52:26 +00:00
Ali El Gariani
662e60bfe1 Simplify header dependency 2010-06-14 15:02:44 +00:00
Eric S. Raymond
0e0b0fd70f Committing patch #1578: Resolution problem fix.
Fixes bug #15773: in windowed resolution for 1024x600 monitors is
1024x768 if the video card supports it.
2010-04-02 21:06:52 +00:00
Mark de Wever
92f5f92ce5 New year copyright update. 2010-01-01 13:16:49 +00:00
Guillaume Melquiond
e624420d96 Removed unused functions CVideo::get*. 2009-08-16 17:17:56 +00:00
Guillaume Melquiond
fca395d007 Removed unused functions CVideo::*lock. 2009-08-16 17:17:51 +00:00