mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
2fa5e339fc
So that for anything new I don't have to bother with the awful 2D interface Build provides.
196 lines
7.1 KiB
C++
196 lines
7.1 KiB
C++
#pragma once
|
|
/*
|
|
** v_video.h
|
|
**
|
|
**---------------------------------------------------------------------------
|
|
** Copyright 1998-2008 Randy Heit
|
|
** All rights reserved.
|
|
**
|
|
** Redistribution and use in source and binary forms, with or without
|
|
** modification, are permitted provided that the following conditions
|
|
** are met:
|
|
**
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
** notice, this list of conditions and the following disclaimer.
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
** documentation and/or other materials provided with the distribution.
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
** derived from this software without specific prior written permission.
|
|
**
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
**---------------------------------------------------------------------------
|
|
**
|
|
*/
|
|
|
|
|
|
#include "palentry.h"
|
|
#include "renderstyle.h"
|
|
#include "c_cvars.h"
|
|
#include "v_2ddrawer.h"
|
|
|
|
#define TAG_DONE (0) /* Used to indicate the end of the Tag list */
|
|
#define TAG_END (0) /* Ditto */
|
|
/* list pointed to in ti_Data */
|
|
|
|
enum
|
|
{
|
|
DTA_Base = 1,
|
|
DTA_DestWidth, // width of area to draw to
|
|
DTA_DestHeight, // height of area to draw to
|
|
DTA_Alpha, // alpha value for translucency
|
|
DTA_FillColor, // color to stencil onto the destination
|
|
DTA_TranslationIndex, // translation table to recolor the source
|
|
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
|
|
DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac
|
|
DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen
|
|
DTA_Bottom320x200, // bool: same as DTA_320x200 but centers virtual screen on bottom for 1280x1024 targets
|
|
DTA_CleanNoMove, // bool: like DTA_Clean but does not reposition output position
|
|
DTA_CleanNoMove_1, // bool: like DTA_CleanNoMove, but uses Clean[XY]fac_1 instead
|
|
DTA_FlipX, // bool: flip image horizontally //FIXME: Does not work with DTA_Window(Left|Right)
|
|
DTA_ShadowColor, // color of shadow
|
|
DTA_ShadowAlpha, // alpha of shadow
|
|
DTA_Shadow, // set shadow color and alphas to defaults
|
|
DTA_VirtualWidth, // pretend the canvas is this wide
|
|
DTA_VirtualHeight, // pretend the canvas is this tall
|
|
DTA_TopOffset, // override texture's top offset
|
|
DTA_LeftOffset, // override texture's left offset
|
|
DTA_CenterOffset, // bool: override texture's left and top offsets and set them for the texture's middle
|
|
DTA_CenterBottomOffset,// bool: override texture's left and top offsets and set them for the texture's bottom middle
|
|
DTA_WindowLeft, // don't draw anything left of this column (on source, not dest)
|
|
DTA_WindowRight, // don't draw anything at or to the right of this column (on source, not dest)
|
|
DTA_ClipTop, // don't draw anything above this row (on dest, not source)
|
|
DTA_ClipBottom, // don't draw anything at or below this row (on dest, not source)
|
|
DTA_ClipLeft, // don't draw anything to the left of this column (on dest, not source)
|
|
DTA_ClipRight, // don't draw anything at or to the right of this column (on dest, not source)
|
|
DTA_Masked, // true(default)=use masks from texture, false=ignore masks
|
|
DTA_HUDRules, // use fullscreen HUD rules to position and size textures
|
|
DTA_HUDRulesC, // only used internally for marking HUD_HorizCenter
|
|
DTA_KeepRatio, // doesn't adjust screen size for DTA_Virtual* if the aspect ratio is not 4:3
|
|
DTA_RenderStyle, // same as render style for actors
|
|
DTA_ColorOverlay, // uint32_t: ARGB to overlay on top of image; limited to black for software
|
|
DTA_BilinearFilter, // bool: apply bilinear filtering to the image
|
|
DTA_SpecialColormap,// pointer to FSpecialColormapParameters
|
|
DTA_Desaturate, // explicit desaturation factor (does not do anything in Legacy OpenGL)
|
|
DTA_Fullscreen, // Draw image fullscreen (same as DTA_VirtualWidth/Height with graphics size.)
|
|
|
|
// floating point duplicates of some of the above:
|
|
DTA_DestWidthF,
|
|
DTA_DestHeightF,
|
|
DTA_TopOffsetF,
|
|
DTA_LeftOffsetF,
|
|
DTA_VirtualWidthF,
|
|
DTA_VirtualHeightF,
|
|
DTA_WindowLeftF,
|
|
DTA_WindowRightF,
|
|
|
|
// For DrawText calls:
|
|
DTA_TextLen, // stop after this many characters, even if \0 not hit
|
|
DTA_CellX, // horizontal size of character cell
|
|
DTA_CellY, // vertical size of character cell
|
|
|
|
// New additions.
|
|
DTA_Color,
|
|
DTA_FlipY, // bool: flip image vertically
|
|
DTA_SrcX, // specify a source rectangle (this supersedes the poorly implemented DTA_WindowLeft/Right
|
|
DTA_SrcY,
|
|
DTA_SrcWidth,
|
|
DTA_SrcHeight,
|
|
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
|
|
DTA_Burn, // activates the burn shader for this element
|
|
DTA_Spacing, // Strings only: Additional spacing between characters
|
|
DTA_Monospace, // Fonts only: Use a fixed distance between characters.
|
|
};
|
|
|
|
enum EMonospacing : int
|
|
{
|
|
Off = 0,
|
|
CellLeft = 1,
|
|
CellCenter = 2,
|
|
CellRight = 3
|
|
};
|
|
|
|
enum
|
|
{
|
|
HUD_Normal,
|
|
HUD_HorizCenter
|
|
};
|
|
|
|
|
|
class FFont;
|
|
|
|
struct DrawParms
|
|
{
|
|
double x, y;
|
|
double texwidth;
|
|
double texheight;
|
|
double destwidth;
|
|
double destheight;
|
|
double virtWidth;
|
|
double virtHeight;
|
|
double windowleft;
|
|
double windowright;
|
|
int cleanmode;
|
|
int dclip;
|
|
int uclip;
|
|
int lclip;
|
|
int rclip;
|
|
double top;
|
|
double left;
|
|
float Alpha;
|
|
int remap;
|
|
PalEntry fillcolor;
|
|
PalEntry colorOverlay;
|
|
PalEntry color;
|
|
int alphaChannel;
|
|
int flipX;
|
|
int flipY;
|
|
//float shadowAlpha;
|
|
int shadowColor;
|
|
int keepratio;
|
|
int masked;
|
|
int bilinear;
|
|
FRenderStyle style;
|
|
int desaturate;
|
|
int scalex, scaley;
|
|
int cellx, celly;
|
|
int monospace;
|
|
int spacing;
|
|
int maxstrlen;
|
|
bool fortext;
|
|
bool virtBottom;
|
|
double srcx, srcy;
|
|
double srcwidth, srcheight;
|
|
bool burn;
|
|
};
|
|
|
|
struct Va_List
|
|
{
|
|
va_list list;
|
|
};
|
|
|
|
int CheckRatio (int width, int height, int *trueratio=NULL);
|
|
static inline int CheckRatio (double width, double height) { return CheckRatio(int(width), int(height)); }
|
|
inline bool IsRatioWidescreen(int ratio) { return (ratio & 3) != 0; }
|
|
|
|
float ActiveRatio (int width, int height, float *trueratio = NULL);
|
|
static inline double ActiveRatio (double width, double height) { return ActiveRatio(int(width), int(height)); }
|
|
|
|
int AspectBaseWidth(float aspect);
|
|
int AspectBaseHeight(float aspect);
|
|
double AspectPspriteOffset(float aspect);
|
|
int AspectMultiplier(float aspect);
|
|
bool AspectTallerThanWide(float aspect);
|
|
void ScaleWithAspect(int &w, int &h, int Width, int Height);
|
|
|
|
int GetUIScale(int altval);
|
|
int GetConScale(int altval);
|