]> git.vomp.tv Git - vompclient.git/blob - osdwinpixel.cc
Remove some dead code, rename some things
[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 #include "defines.h"
21
22 #ifndef GRADIENT_DRAWING
23
24 #include "osdwinpixel.h"
25 #include "videowin.h"
26 #include "surfacewin.h"
27
28
29 #include "message.h"
30 #include "control.h"
31
32
33
34 //This is stuff for rendering the OSD
35
36 OsdWinPixel::OsdWinPixel()
37 {
38
39
40   
41 }
42
43 OsdWinPixel::~OsdWinPixel()
44 {
45   if (initted) 
46   {
47                 shutdown();
48   }
49 }
50
51 Surface * OsdWinPixel::createNewSurface(){
52         return (Surface*)new SurfaceWin();
53 }
54
55 int OsdWinPixel::init()
56 {
57   if (initted) return 0;
58
59   if (!createDirect3D9Objects()) return 0;
60   GdiplusStartup(&gdiptoken, &gdipstartup, NULL);
61
62   VideoWin* video = (VideoWin*)Video::getInstance();
63   //Now we will create the Screen
64   screen = new SurfaceWin(Surface::SCREEN);
65   screen->create(video->getScreenWidth(), video->getScreenHeight());
66   screen->display();
67   initted = true; // must set this here or create surface won't work
68
69   startRenderLoop();
70
71   return 1;
72 }
73
74
75 int OsdWinPixel::shutdown()
76 {
77   if (!initted) return 0;
78   initted = false;
79   stopRenderLoop();
80   shutdownDirect3D9Objects();
81  
82   Gdiplus::GdiplusShutdown(gdiptoken);
83
84   return 1;
85 }
86
87 void OsdWinPixel::screenShot(const char* fileName)
88 {
89   screen->screenShot(fileName);
90 }
91
92 LPDIRECT3DTEXTURE9 OsdWinPixel::getNextOsdTexture()
93 {
94         return ((SurfaceWin*)screen)->getD3dtexture();
95 }
96
97 void OsdWinPixel::lostDestroyObjects()
98 {
99         ((SurfaceWin*)screen)->ReleaseSurface();
100 }
101
102 void OsdWinPixel::lostRecreateObjects()
103 {
104         Video *video = Video::getInstance();
105         screen->create(video->getScreenWidth(), video->getScreenHeight());
106         screen->display();
107 }
108
109 void OsdWinPixel::getTextureCoordinates(FLOAT*x, FLOAT*y)
110 {
111         Video* video = Video::getInstance();
112         FLOAT texx = ((float)video->getScreenWidth()) / 1024.f;
113         FLOAT texy = ((float)video->getScreenHeight()) / 1024.f;
114         *x = texx;
115         *y = texy;
116
117 }
118 #endif