| 43 | |
| 44 | using namespace Poseidon; |
| 45 | void DrawFrame(Texture* corner, PackedColor color, const Rect2DPixel& frame) |
| 46 | { |
| 47 | const int screenW = GLOB_ENGINE->Width2D(); |
| 48 | const int screenH = GLOB_ENGINE->Height2D(); |
| 49 | |
| 50 | MipInfo mip = GLOB_ENGINE->TextBank()->UseMipmap(corner, 0, 0); |
| 51 | float invCornerH = 1, invCornerW = 1; |
| 52 | if (corner) |
| 53 | { |
| 54 | invCornerH = 1200.0 * (1.0 / (screenH * corner->AHeight())); |
| 55 | invCornerW = 1600.0 * (1.0 / (screenW * corner->AWidth())); |
| 56 | } |
| 57 | Draw2DPars pars; |
| 58 | Rect2DPixel rect; |
| 59 | rect.w = 0.5 * frame.w; |
| 60 | rect.h = 0.5 * frame.h; |
| 61 | pars.mip = mip; |
| 62 | pars.SetColor(color); |
| 63 | pars.spec = NoZBuf | IsAlpha | ClampU | ClampV | IsAlphaFog; |
| 64 | float coefX = 0.5 * frame.w * invCornerW; |
| 65 | float coefY = 0.5 * frame.h * invCornerH; |
| 66 | |
| 67 | rect.x = frame.x; |
| 68 | rect.y = frame.y; |
| 69 | pars.SetU(0, coefX); |
| 70 | pars.SetV(0, coefY); |
| 71 | GLOB_ENGINE->Draw2D(pars, rect); |
| 72 | |
| 73 | rect.x = frame.x + rect.w; |
| 74 | rect.y = frame.y; |
| 75 | pars.SetU(coefX, 0); |
| 76 | pars.SetV(0, coefY); |
| 77 | GLOB_ENGINE->Draw2D(pars, rect); |
| 78 | |
| 79 | rect.x = frame.x; |
| 80 | rect.y = frame.y + rect.h; |
| 81 | pars.SetU(0, coefX); |
| 82 | pars.SetV(coefY, 0); |
| 83 | GLOB_ENGINE->Draw2D(pars, rect); |
| 84 | |
| 85 | rect.x = frame.x + rect.w; |
| 86 | rect.y = frame.y + rect.h; |
| 87 | pars.SetU(coefX, 0); |
| 88 | pars.SetV(coefY, 0); |
| 89 | GLOB_ENGINE->Draw2D(pars, rect); |
| 90 | |
| 91 | // GLOB_ENGINE->TextBank()->ReleaseMipmap(); |
| 92 | } |
| 93 | |
| 94 | struct DrawActionInfo |
| 95 | { |
no test coverage detected