MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / R_drawMenus

Function R_drawMenus

engine/src/game.cpp:1972–2093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1970}
1971
1972void R_drawMenus()
1973{
1974 float tw = 32.0f;
1975 float th = -tw;
1976 float tx = game.renderTargets.menuPanel.width / 2 - 5 * tw;
1977 float ty = game.renderTargets.menuPanel.height / 2 - th;
1978
1979 int lw = 8;
1980
1981 float bw = game.renderTargets.menuPanel.width - lw;
1982 float bh = game.renderTargets.menuPanel.height - lw;
1983 float bx = 0;
1984 float by = 0;
1985
1986 glDisable(GL_TEXTURE_2D);
1987 glBegin(GL_QUADS);
1988 {
1989 glColor4f(0.0f, 0.0f, 0.25f, 1.0f);
1990 glVertex2f(bx, by);
1991 glVertex2f(bx + bw, by);
1992 glColor4f(0.0f, 0.0f, 0.25f, 0.70f);
1993 glVertex2f(bx + bw, by + bh);
1994 glVertex2f(bx, by + bh);
1995 }
1996 glEnd();
1997
1998 glBegin(GL_QUADS);
1999 {
2000 glColor4f(0.5f, 0.5f, 1.0f, 1.0f);
2001
2002 glVertex2i(bx, by);
2003 glVertex2i(bx + bw + lw, by);
2004 glVertex2i(bx + bw + lw, by + lw);
2005 glVertex2i(bx, by + lw);
2006
2007 glVertex2i(bx + bw, by);
2008 glVertex2i(bx + bw + lw, by);
2009 glVertex2i(bx + bw + lw, by + bh + lw);
2010 glVertex2i(bx + bw, by + bh);
2011
2012 glVertex2i(bx, by + bh);
2013 glVertex2i(bx + bw + lw, by + bh);
2014 glVertex2i(bx + bw + lw, by + bh + lw);
2015 glVertex2i(bx, by + bh + lw);
2016
2017 glVertex2i(bx, by);
2018 glVertex2i(bx + lw, by);
2019 glVertex2i(bx + lw, by + bh + lw);
2020 glVertex2i(bx, by + bh);
2021 }
2022 glEnd();
2023 glEnable(GL_TEXTURE_2D);
2024
2025 if (game.menu.current->name != NULL)
2026 font.displayText(tx + 64.0f, by - 2 * th, tw, th, 1.0f, 1.0f, 1.0f,
2027 game.menu.current->name);
2028 for (int i = 0; i < game.menu.current->items.size(); i++)
2029 {

Callers 1

R_renderFunction · 0.85

Calls 4

ScreenRectClass · 0.85
DrawQuadFunction · 0.85
R_drawSelectedMenuItemFunction · 0.85
displayTextMethod · 0.80

Tested by

no test coverage detected