]> git.vomp.tv Git - vompclient.git/blob - osdwinpixel.cc
Split OsdWin into OsdWinPixel and WindowsOsd as preparation for Vector
[vompclient.git] / osdwinpixel.cc
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21
22 #include "osdwinpixel.h"
23 #include "mtd.h"
24 #include "videowin.h"
25 #include "surfacewin.h"
26
27
28 #include "message.h"
29 #include "command.h"
30
31
32
33 //This is stuff for rendering the OSD
34
35 OsdWinPixel::OsdWinPixel()
36 {
37
38
39   
40 }
41
42 OsdWinPixel::~OsdWinPixel()
43 {
44   if (initted) 
45   {
46                 shutdown();
47   }
48 }
49
50 int OsdWinPixel::getFD()
51 {
52   if (!initted) return 0;
53   return fdOsd;
54 }
55
56 Surface * OsdWinPixel::createNewSurface(){
57         return (Surface*)new SurfaceWin();
58 }
59
60 int OsdWinPixel::init(void* device)
61 {
62   if (initted) return 0;
63
64   if (!createDirect3D9Objects()) return 0;
65   GdiplusStartup(&gdiptoken, &gdipstartup, NULL);
66
67   VideoWin* video = (VideoWin*)Video::getInstance();
68   //Now we will create the Screen
69   screen = new SurfaceWin(Surface::SCREEN);
70   screen->create(video->getScreenWidth(), video->getScreenHeight());
71   screen->display();
72   initted = 1; // must set this here or create surface won't work
73
74   startRenderLoop();
75
76   return 1;
77 }
78
79
80 int OsdWinPixel::shutdown()
81 {
82   if (!initted) return 0;
83   initted = 0;
84   shutdownDirect3D9Objects();
85  
86   Gdiplus::GdiplusShutdown(gdiptoken);
87
88   return 1;
89 }
90
91 void OsdWinPixel::screenShot(const char* fileName)
92 {
93   screen->screenShot(fileName);
94 }
95
96 LPDIRECT3DTEXTURE9 OsdWinPixel::getNextOsdTexture()
97 {
98         return ((SurfaceWin*)screen)->getD3dtexture();
99 }
100
101 void OsdWinPixel::lostDestroyObjects()
102 {
103         ((SurfaceWin*)screen)->ReleaseSurface();
104 }
105
106 void OsdWinPixel::lostRecreateObjects()
107 {
108         Video *video = Video::getInstance();
109         screen->create(video->getScreenWidth(), video->getScreenHeight());
110         screen->display();
111 }
112
113