ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

nodeframe.cpp

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "engines/myst3/directorysubentry.h"
00024 #include "engines/myst3/myst3.h"
00025 #include "engines/myst3/nodeframe.h"
00026 #include "engines/myst3/scene.h"
00027 #include "engines/myst3/state.h"
00028 
00029 namespace Myst3 {
00030 
00031 NodeFrame::NodeFrame(Myst3Engine *vm, uint16 id) :
00032         Node(vm, id) {
00033     const DirectorySubEntry *jpegDesc = _vm->getFileDescription("", id, 1, DirectorySubEntry::kLocalizedFrame);
00034 
00035     if (!jpegDesc)
00036         jpegDesc = _vm->getFileDescription("", id, 0, DirectorySubEntry::kFrame);
00037 
00038     if (!jpegDesc)
00039         jpegDesc = _vm->getFileDescription("", id, 1, DirectorySubEntry::kFrame);
00040 
00041     if (!jpegDesc)
00042         error("Frame %d does not exist", id);
00043 
00044     _faces[0] = new Face(_vm);
00045     _faces[0]->setTextureFromJPEG(jpegDesc);
00046 }
00047 
00048 NodeFrame::~NodeFrame() {
00049 }
00050 
00051 void NodeFrame::draw() {
00052     Common::Rect screenRect;
00053 
00054     // Size and position of the frame
00055     if (_vm->_state->getViewType() == kMenu) {
00056         screenRect = Common::Rect(Renderer::kOriginalWidth, Renderer::kOriginalHeight);
00057     } else {
00058         screenRect = Common::Rect(Renderer::kOriginalWidth, Renderer::kFrameHeight);
00059     }
00060 
00061     // Used fragment of texture
00062     Common::Rect textureRect = Common::Rect(screenRect.width(), screenRect.height());
00063 
00064     // Update the OpenGL texture if needed
00065     _faces[0]->uploadTexture();
00066 
00067     // Draw
00068     _vm->_gfx->drawTexturedRect2D(screenRect, textureRect, _faces[0]->_texture);
00069 }
00070 
00071 } // End of namespace Myst3


Generated on Sat Oct 12 2019 05:00:58 for ResidualVM by doxygen 1.7.1
curved edge   curved edge