fna-workbench

fna-workbench Commit Details


Date:2016-01-22 09:01:17 (9 years 7 months ago)
Author:Ethan Lee
Branch:master
Commit:344273bc7958528d6cbf61f871887501199577d7
Parents: 39023e15e94ded94f79efb20391ad3a1b101616a
Message:Init/Exit FNAPlatform changes

Changes:

File differences

src/FNAPlatform.cs
3636
3737
3838
39
40
39
40
4141
4242
4343
......
5959
6060
6161
62
63
64
6265
6366
6467
6568
6669
6770
68
69
71
72
7073
71
72
74
75
7376
7477
7578
// Environment.GetEnvironmentVariable("FNA_PLATFORM_BACKEND");
Init =SDL2_FNAPlatform.Init;
Dispose =SDL2_FNAPlatform.Dispose;
CreateWindow =SDL2_FNAPlatform.CreateWindow;
DisposeWindow =SDL2_FNAPlatform.DisposeWindow;
BeforeInitialize =SDL2_FNAPlatform.BeforeInitialize;
RunLoop =SDL2_FNAPlatform.RunLoop;
CreateGLDevice =SDL2_FNAPlatform.CreateGLDevice;
ShowRuntimeError =SDL2_FNAPlatform.ShowRuntimeError;
TextureDataFromStream =SDL2_FNAPlatform.TextureDataFromStream;
SavePNG =SDL2_FNAPlatform.SavePNG;
AppDomain.CurrentDomain.ProcessExit += SDL2_FNAPlatform.ProgramExit;
SDL2_FNAPlatform.ProgramInit();
}
#endregion
#region Public Static Methods
public delegate void InitFunc(Game game);
public static InitFunc Init;
public delegate GameWindow CreateWindowFunc();
public static CreateWindowFunc CreateWindow;
public delegate void DisposeFunc(Game game);
public static DisposeFunc Dispose;
public delegate void DisposeWindowFunc(GameWindow window);
public static DisposeWindowFunc DisposeWindow;
public delegate void BeforeInitializeFunc();
public static BeforeInitializeFunc BeforeInitialize;
src/Game.cs
287287
288288
289289
290
290
291291
292292
293293
......
349349
350350
351351
352
352
353
354
355
356
353357
354358
355359
_components = new GameComponentCollection();
_content = new ContentManager(_services);
FNAPlatform.Init(this);
Window = FNAPlatform.CreateWindow();
AudioDevice.Initialize();
AudioDevice.Dispose();
FNAPlatform.Dispose(this);
if (Window != null)
{
FNAPlatform.DisposeWindow(Window);
Window = null;
}
Mouse.WindowHandle = IntPtr.Zero;
ContentTypeReaderManager.ClearTypeCreators();
src/SDL2/SDL2_FNAPlatform.cs
3333
3434
3535
36
36
3737
3838
3939
......
7272
7373
7474
75
7576
76
77
78
79
80
81
82
83
84
85
7786
7887
7988
8089
8190
8291
83
92
93
94
8495
8596
8697
......
93104
94105
95106
107
108
96109
97110
98
111
99112
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
113
114
115
116
117
118
119
120
121
122
117123
118
119
124
120125
121126
122127
#region Public Static Methods
public static void Init(Game game)
public static void ProgramInit()
{
/* SDL2 might complain if an OS that uses SDL_main has not actually
* used SDL_main by the time you initialize SDL2.
mappingsDB
);
}
}
// Set and initialize the SDL2 window
public static void ProgramExit(object sender, EventArgs e)
{
// This _should_ be the last SDL call we make...
SDL.SDL_Quit();
}
public static GameWindow CreateWindow()
{
// GLContext environment variables
bool forceES2 = Environment.GetEnvironmentVariable(
"FNA_OPENGL_FORCE_ES2"
) == "1";
bool forceCoreProfile = Environment.GetEnvironmentVariable(
"FNA_OPENGL_FORCE_CORE_PROFILE"
) == "1";
game.Window = new SDL2_GameWindow(
// Set and initialize the SDL2 window
GameWindow result = new SDL2_GameWindow(
forceES2 ||
OSVersion.Equals("Emscripten") ||
OSVersion.Equals("Android") ||
// We hide the mouse cursor by default.
SDL.SDL_ShowCursor(0);
return result;
}
public static void Dispose(Game game)
public static void DisposeWindow(GameWindow window)
{
if (game.Window != null)
{
/* Some window managers might try to minimize the window as we're
* destroying it. This looks pretty stupid and could cause problems,
* so set this hint right before we destroy everything.
* -flibit
*/
SDL.SDL_SetHintWithPriority(
SDL.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS,
"0",
SDL.SDL_HintPriority.SDL_HINT_OVERRIDE
);
SDL.SDL_DestroyWindow(game.Window.Handle);
game.Window = null;
}
/* Some window managers might try to minimize the window as we're
* destroying it. This looks pretty stupid and could cause problems,
* so set this hint right before we destroy everything.
* -flibit
*/
SDL.SDL_SetHintWithPriority(
SDL.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS,
"0",
SDL.SDL_HintPriority.SDL_HINT_OVERRIDE
);
// This _should_ be the last SDL call we make...
SDL.SDL_Quit();
SDL.SDL_DestroyWindow(window.Handle);
}
public static void RunLoop(Game game)

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.82559s using 13 queries.