MercuryWindowEE.cpp

Go to the documentation of this file.
00001 #include "MercuryWindowEE.h"
00002 #include "MercuryLog.h"
00003 #include "MercuryDisplay.h"
00004 #include "MercuryUtil.h"
00005 #include <sifrpc.h>
00006 
00007 #include <draw.h>
00008 #include <graph.h>
00009 #include <math3d.h>
00010 
00011 MercuryWindowEE::MercuryWindowEE()
00012 :MercuryWindow(0,0,false)
00013 {
00014     LOG.Log("Video render: EE/Draw&Graph");
00015 }
00016 
00017 MercuryWindowEE::~MercuryWindowEE()
00018 {
00019     DestroyWindowAndRender();
00020 }
00021 
00022 bool MercuryWindowEE::MakeWindow(const char* title, int width, int height, int bits, bool fullscreenflag)
00023 {
00024 //  Don't call this function, doing so will cause the PS2 to crash.  I have no idea why.
00025 //  SifInitRpc(0);
00026     return true;
00027 }
00028 
00029 void MercuryWindowEE::DestroyWindow()
00030 {
00031     graph_shutdown();
00032 }
00033 
00034 void* MercuryWindowEE::GetProcAddress( MString s )
00035 {
00036     return NULL;
00037 }
00038 
00039 void MercuryWindowEE::SwapBuffersInternal() 
00040 {
00041     graph_wait_vsync();
00042     draw_swap();
00043 }
00044 
00045 bool MercuryWindowEE::Update(const float dTime)
00046 {
00047 /*
00048     if (EE_PollEvent(&m_event))
00049     {
00050         switch(m_event.type)
00051         {
00052             case EE_VIDEORESIZE:
00053                 DISPLAY->Resize((int)m_event.resize.w, (int)m_event.resize.h);
00054                 EE_SetVideoMode( m_width, m_height, m_bits, m_flags );
00055                 break;
00056             case EE_QUIT:
00057                 return false;
00058             case EE_MOUSEMOTION:
00059                 break;
00060         }
00061     }
00062 */
00063     return true;
00064 }
00065 
00066 bool MercuryWindowEE::HasFocus()
00067 {
00068     return true;
00069 }
00070 
00071 void MercuryWindowEE::DestroyWindowAndRender()
00072 {
00073     DestroyWindow();
00074 }
00075 
00076 bool MercuryWindowEE::RestoreDevice()
00077 {
00078     return true;
00079 }
00080 
00081 bool MercuryWindowEE::MakeRenderCurrent()
00082 {
00083     return true;
00084 }
00085 
00086 bool MercuryWindowEE::MakeRender(const char* title, int width, int height, int bits, bool fullscreenflag, RendererType RT )
00087 {
00088     LOG.Log( "EE JOSH XMaking Renderer..." );
00089 
00090     SetTitle(title);
00091 
00092     printf("%%%%%%%%%%%%%%%%%%\n");
00093     draw_initialize(GRAPH_MODE_AUTO, GRAPH_PSM_32, GRAPH_PSM_32);
00094 
00095     //Completly clear the window.
00096     draw_clear(0,0,0);
00097     graph_wait_vsync();
00098     // Swap the buffers.
00099     draw_swap();
00100     draw_clear(0,0,0);
00101 
00102     m_width = graph_get_width();
00103     m_height  = graph_get_width();
00104     m_bits = graph_get_bpp();
00105     LOG.Info( ssprintf( "Got video mode: %d x %d, bits: %d", m_width, m_height, m_bits ) );
00106     return true;
00107 }
00108 
00109 /* 
00110  * Copyright (c) 2005-2006, Joshua Allen
00111  * All rights reserved.
00112  *
00113  * Redistribution and use in source and binary forms, with or
00114  * without modification, are permitted provided that the following
00115  * conditions are met:
00116  *  -   Redistributions of source code must retain the above
00117  *      copyright notice, this list of conditions and the following disclaimer.
00118  *  -   Redistributions in binary form must reproduce the above copyright
00119  *      notice, this list of conditions and the following disclaimer in
00120  *      the documentation and/or other materials provided with the distribution.
00121  *  -   Neither the name of the Mercury Engine nor the names of its
00122  *      contributors may be used to endorse or promote products derived from
00123  *      this software without specific prior written permission.
00124  *
00125  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00126  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00127  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00128  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00129  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00130  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00131  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00132  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00133  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00134  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00135  */

Hosted by SourceForge.net Logo