- [NEW] Triggers, pa enablar i disablar coses en calent
- [WIP] Treballant en el depth buffer - [FIX] Ja canvia de sector com toca sempre - [NEW] Ja pinta el cel - [NEW] El minimap es pot activar i desactivar amb "M"
This commit is contained in:
10
draw.cpp
10
draw.cpp
@@ -16,6 +16,7 @@ namespace draw
|
||||
Uint32 *palette;
|
||||
Uint8 screen[320*240];
|
||||
float depth_buffer[320*240];
|
||||
float clear_block[256];
|
||||
|
||||
void init()
|
||||
{
|
||||
@@ -26,11 +27,13 @@ namespace draw
|
||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 240);
|
||||
SDL_SetTextureScaleMode(sdl_texture, SDL_SCALEMODE_NEAREST);
|
||||
debug::init(sdl_renderer);
|
||||
for (int i=0;i<256;++i) clear_block[i] = 0;
|
||||
}
|
||||
|
||||
void cls()
|
||||
{
|
||||
memset(screen, 0, 320*240);
|
||||
int pos=0; for (int i=0;i<300;++i) { memcpy(&depth_buffer[pos], clear_block, 256); pos+=256; }
|
||||
}
|
||||
|
||||
surface_t *newsurf(int w, int h)
|
||||
@@ -85,8 +88,11 @@ namespace draw
|
||||
void putpd(int x, int y, Uint8 color, float depth)
|
||||
{
|
||||
if (x<0 || y<0 || x>=320 || y>=240) return;
|
||||
screen[x+y*320]=color;
|
||||
depth_buffer[x+y*320]=depth;
|
||||
//if (depth_buffer[x+y*320]<=depth)
|
||||
//{
|
||||
screen[x+y*320]=color;
|
||||
depth_buffer[x+y*320]=depth;
|
||||
//}
|
||||
}
|
||||
|
||||
void putps(int x, int y, Uint8 color, float depth)
|
||||
|
||||
Reference in New Issue
Block a user