예제 #1
0
파일: Rect.cpp 프로젝트: liujw/SceneEditor
 void insertRect(TY** ppY,const TRect& rect){
     TY* pY=*ppY;
     if (rect.y1 <= pY->y0){  //之前
         insertAtFront(ppY,rect);
     }else if (rect.y0 >= pY->y1){ //之后
         insertRectNext(pY,rect);
     }else if (getIsCover(pY,rect)){ //包含
         return;
     }else{ //相交
         TRect nRect(rect);
         if (nRect.y1 > pY->y1){ //长出一截的部分交给下一个Y
             TRect backRect(nRect.x0,pY->y1,nRect.x1,nRect.y1);
             nRect.y1=pY->y1;
             insertRectNext(pY,backRect);
         }else if (nRect.y1< pY->y1){ //短一截,分裂Y
             clipY(pY,nRect.y1);
         }
         //nRect.y1==pY->y1
         
         if (nRect.y0 < pY->y0){ 
             TRect frontRect(nRect.x0,nRect.y0,nRect.x1,pY->y0);
             nRect.y0=pY->y0;
             YAddAX(pY,nRect.x0,nRect.x1);				
             insertAtFront(ppY,frontRect);
         }else if (nRect.y0< pY->y0){
             clipY(pY,nRect.y0);
             YAddAX(pY->nextY,nRect.x0,nRect.x1);
         }else{ //nRect.y0== pY->y0			
             YAddAX(pY,nRect.x0,nRect.x1);
         }
     }
 }
예제 #2
0
					str[strIdx] = character.character;
					strIdx++;
				}
			}

			if (strIdx > 0)
			{
				// reset
				str[strIdx] = L'\0';

				strIdx = 0;

				// convert to a wstring manually and trim off any trailing spaces (as they make font-renderer sad)
				fwWString strBits(str);
				strBits.erase(strBits.find_last_not_of(' ') + 1);

				// write!
				CRect frontRect((strStart * 16.0f) + 8.0f, y + 8.0f, GetScreenResolutionX() - 8.0f, y + 8.0f);

				TheFonts->DrawText(strBits, frontRect, frontColor, 16.0f, 1.0f, "Lucida Console");
			}
		}

		int cx, cy;
		ConHost_GetCursorPos(cx, cy);

		CRect cursorRect(cx * stringRect.Width() + 8.0f, cy * 16.0f + 14.0f + 8.0f, cx * stringRect.Width() + stringRect.Width() + 8.0f, cy * 16.0f + 16.0f + 8.0f);

		TheFonts->DrawRectangle(cursorRect, CRGBA(255, 255, 255));
	}, 90);
});