00001 /***************************************************************************************** 00002 Copyright (c) 2002 The UbixOS Project 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without modification, are 00006 permitted provided that the following conditions are met: 00007 00008 Redistributions of source code must retain the above copyright notice, this list of 00009 conditions, the following disclaimer and the list of authors. Redistributions in binary 00010 form must reproduce the above copyright notice, this list of conditions, the following 00011 disclaimer and the list of authors in the documentation and/or other materials provided 00012 with the distribution. Neither the name of the UbixOS Project nor the names of its 00013 contributors may be used to endorse or promote products derived from this software 00014 without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 00017 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00018 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 00019 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00020 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00021 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00022 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 00023 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00024 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00025 00026 $Id: ogprintf_8cc-source.html 88 2016-01-12 00:11:29Z reddawg $ 00027 00028 *****************************************************************************************/ 00029 00030 #include <objgfx40/objgfx40.h> 00031 #include <objgfx40/ogFont.h> 00032 #include <sde/ogDisplay_UbixOS.h> 00033 00034 extern "C" { 00035 00036 #include <ubixos/vitals.h> 00037 00038 00039 static int screenRow = 0x0; 00040 static int screenCol = 0x1; 00041 00042 int ogPrintf(char *s) { 00043 int i = 0x0; 00044 int bufHeight; 00045 ogSurface *screen = (ogDisplay_UbixOS *)systemVitals->screen; 00046 ogBitFont *font = (ogBitFont *)systemVitals->font; 00047 00048 00049 while ('\0' != s[i]) { 00050 switch (s[i]) { 00051 case '\t': 00052 screenCol += 3; 00053 break; 00054 case '\b': 00055 if (screenCol > 0) --screenCol; 00056 case '\n': 00057 screenCol = 0; 00058 00059 bufHeight = ((screen->ogGetMaxY()+1) / font->GetHeight())-1; 00060 if (screenRow < bufHeight) 00061 ++screenRow; 00062 else { 00063 screen->ogCopyBuf(0, 0, 00064 *screen, 00065 0, font->GetHeight(), 00066 screen->ogGetMaxX(), screen->ogGetMaxY()); 00067 screen->ogFillRect(0, bufHeight * font->GetHeight()+1, 00068 screen->ogGetMaxX(), screen->ogGetMaxY(), 00069 screen->ogPack(122, 140, 163)); 00070 } 00071 break; 00072 default: 00073 font->PutChar(*screen, 00074 screenCol * font->GetWidth(), 00075 screenRow * font->GetHeight(), 00076 s[i]); 00077 break; 00078 } /* switch */ 00079 ++screenCol; 00080 ++i; 00081 } /* while */ 00082 00083 return 0; 00084 } // ogPrintf 00085 00086 } 00087 00088 /*** 00089 $Log: ogprintf_8cc-source.html,v $ 00089 Revision 1.7 2006/12/15 17:47:06 reddawg 00089 Updates 00089 00090 Revision 1.1.1.1 2006/06/01 12:46:16 reddawg 00091 ubix2 00092 00093 Revision 1.2 2005/10/12 00:13:37 reddawg 00094 Removed 00095 00096 Revision 1.1.1.1 2005/09/26 17:24:13 reddawg 00097 no message 00098 00099 Revision 1.7 2004/07/20 22:58:33 reddawg 00100 retiring to the laptop for the night must sync in work to resume from there 00101 00102 Revision 1.6 2004/07/17 14:24:22 reddawg 00103 compile: changes to the way we link the kernel should prevent future errors 00104 00105 Revision 1.5 2004/05/23 23:30:34 reddawg 00106 Fixens 00107 00108 Revision 1.4 2004/05/23 01:40:19 reddawg 00109 Spinlock 00110 00111 Revision 1.3 2004/05/19 17:09:50 flameshadow 00112 chg: Undid previous renaming. This now restores me as the EOOUIAD. 00113 00114 Revision 1.2 2004/04/26 12:56:01 reddawg 00115 Made src/sys/sde Copy and Make the ogPixelFormat.cpp 00116 00117 Revision 1.1.1.1 2004/04/15 12:07:10 reddawg 00118 UbixOS v1.0 00119 00120 Revision 1.19 2004/04/13 16:36:33 reddawg 00121 Changed our copyright, it is all now under a BSD-Style license 00122 00123 END 00124 ***/