LowRES PlayBASIC - 8bit Retro Graphics Library
Releases
Version V0.05 (25th April 2023) (https://www.underwaredesign.com/forums/index.php?topic=4725.msg31172#msg31172)
Version V0.04 (23rd,April, 2023) (https://www.underwaredesign.com/forums/index.php?topic=4725.msg31169#msg31169)
Version V0.02 (21st, April 2023) (https://www.underwaredesign.com/forums/index.php?topic=4725.msg31167#msg31167)
Version V0.01 (Attached bellow)
Blog
Objective: Howdy, this simple library gives the user a true low resolution video buffer with various basic drawing primitives such as Dots / Line / Circles / Boxes. It includes a default FONT and simple SPRITE interface.
The objective is this is recreate an environment that would approximate something that your find in early 8bit / 16bit computers. So the display is Palette Mapped (8bit - 256 max colours) - Small resolution with limited sprites and text abilities..
Related Articles - Building Vic20 Shamus In PlayBASIC (Blog) (https://www.underwaredesign.com/forums/index.php?topic=4469.0)
- PlayBASIC LIVE: How to Make a 320 by 200 16 colour Palette Mapped Screen (22 Nov 2017) (https://www.underwaredesign.com/forums/index.php?topic=4421.0)
- Palette Mapped - Amiga Vampire Demo (16bit) (https://www.underwaredesign.com/forums/index.php?topic=4356.0)
LowRES - API - First Look - (2023-04-18) This is little side project, the objective is to give the user a truer low resolution experience more along the lines of what you'd experience on a retro 8/16bit computer. The library gives the provides the user with an 8bit / 256colour (Palette Mapped) display a collection of primitives such as Dot / Point / Line / Box / Circle / Text and Sprites.
Bellow is a mock up screen created by importing a level from Mario mapped out as picture. The picture is loaded into memory / palette mapped and then streamed to the LowRes display as if it's scrolling.
The foreground is just bunch of random tested primitives over the top... The resolution of the display is 128 wide by 256 high with a pixel res of 4 by 2 which gives a pretty NES looking frame..
Anyway, would have posted all this two days ago but ran into a bug in PlayBASIC. Assumed it was the palette mapping libraries, but it turned out to be the legacy image loader. So just swapped to the FreeImage library and we were good to go..
Download
Attached bellow
2D - LowRES - Raster Bars in PlayBASIC In the demo i'm controlling what colour in the palette to change down the frame per scanline. You can see the colour index in the top left corner of the screen under the framerate.
This is little side project, the objective is to give the user a truer low resolution experience more along the lines of what you'd experience on a retro 8bit / 16bit computer. The library gives the provides the user with an 8bit / 256colour (Palette Mapped) display and a collection of primitives such as Dot / Point / Line / Box / Circle / Text and Sprites.
Bellow is a mock up screen created by importing a level from Mario mapped out as picture. The picture is loaded into memory / palette mapped and then streamed to the LowRes display as if it's scrolling.
The foreground is just bunch of random tested primitives over the top... The resolution of the display is 128 wide by 256 high with a pixel res of 4 by 2 which gives a pretty NES looking frame..
Links:
LowRES LIbrary for PlayBASIC
https://www.underwaredesign.com/forums/index.php?topic=4725.0
https://PlayBASIC.com
https://UnderwareDESIGN.com
#shorts #2d #lowresolution
Over The Ocean by | e s c p | https://escp-music.bandcamp.com
Music promoted by https://www.free-stock-music.com
Creative Commons / Attribution 4.0 International (CC BY 4.0)
https://creativecommons.org/licenses/by/4.0/
Download
Attached to this post
2D - LowRES - LIbrary V004 For PlayBASIC This version includes a sprite sorting and some limited optimizations for display scaling as well as including a screen stretch to make the PlayBASIC window your desktop height
LowRES FunctionsLR_SYNC(())
LR_OpenScreen((Width,Height,PixelWidth,PixelHeight))
LR_CopperSetPalette((ScanLine,ColourINDEX,ThisRGB ))
LR_WritePalette((INDEX,ThisRGB ))
ThisRGB=LR_ReadPalette((INDEX))
LR_DOT((X,Y,INDEX))
Palette_INDEX=LR_POINT((X,Y))
LR_VSTRIP((Y1,Y2,X,INDEX))
LR_HSTRIP((X1,X2,Y,INDEX))
LR_BOX((X1,Y1,X2,Y2,MOde,INDEX))
LR_CLS((INDEX))
LR_FilledCircle((BX,BY,RADIUS,INDEX))
LR_TEXT((X,Y,TEXT$))
Sprite as LR_SPRITE pointer=LR_CreateSprite((SpriteINDEX,Xpos=0,Ypos=0))
LR_DeleteSprite((SpriteINDEX))
LR_PositionSprite((SpriteINDEX,XPOS,YPOS))
LR_SpriteX((SpriteINDEX,XPOS))
LR_SpriteY((SpriteINDEX,YPOS))
Result=LR_GetSpriteX((SpriteINDEX))
Result=LR_GetSpriteY((SpriteINDEX))
Result=LR_GetSpriteWidth((SpriteINDEX))
Result=LR_GetSpriteHEIGHT((SpriteINDEX))
LR_SpriteDEPTH((SpriteINDEX,Depth))
Result=LR_GetSpriteDEPTH((SpriteINDEX))
LR_WriteSprite((SpriteINDEX,X,Y,PaletteINDEX))
Sprite as LR_SPRITE pointer=LR_SPRITEPTR((SpriteINDEX))
LR_DRAWSPRITE((SpriteINDEX))
Overlap=LR_SpritesOverlap((SpriteINDEX1,SpriteINDEX2,Method=1))
LR_WRITEFONT((ThisCHR,X,Y,Palette_INDEX))
INDEX=LR_READFONT((ThisCHR,X,Y))
LR_CreateFONT((Width,Height))
Address=LR_GETCHRPTR((ThisCHR))
LR_Line((xpos1,ypos1,xpos2,ypos2,PaletteINDEX))
LR_WriteToScreen((x1,y1,x2,y2,SrcPtr,SrcModulo))
Related Articles
+ LowRES PlayBASIC Library Function & Psub Parser (https://www.underwaredesign.com/forums/index.php?topic=4727.0)
+ Manually Doing Pixel Perfect Sprite Collisions (Examples & Video) (https://www.underwaredesign.com/forums/index.php?topic=4432.0)
Download
Attached to this post
2D - LowRES - Library V005 For PlayBASIC
This version adds Sprite Collision function with two moths vector and pixel perfect as well as gradient function with Alpha additions for the raster / copper controls
This rounds out the library to something fitting classic 8bit development and beyond. Now the question is what can you coders do with it ? Who's brave enough to eplore 8bit development and build a few demos or even low res games ?
I'd be nice to have a sprite / character set editor. You can import and palette map images, but the PB palette mapping library doesn't do colour reduction.
#indiedev #gamedev #coding #learntocode #8bit #retro #2d #lowres #lowresolution #sourcecode
LowRES Functions
LR_SYNC(())
LR_OpenScreen((Width,Height,PixelWidth,PixelHeight))
LR_CopperSetPalette((ScanLine,ColourINDEX,ThisRGB,Method=1 ))
LR_CopperRainbow((ScanLine,Lines,ColourINDEX,StartRGB,TargetRGB,Method=1))
LR_WritePalette((INDEX,ThisRGB ))
ThisRGB=LR_ReadPalette((INDEX))
LR_DOT((X,Y,INDEX))
Palette_INDEX=LR_POINT((X,Y))
LR_VSTRIP((Y1,Y2,X,INDEX))
LR_HSTRIP((X1,X2,Y,INDEX))
LR_BOX((X1,Y1,X2,Y2,MOde,INDEX))
LR_CLS((INDEX))
LR_FilledCircle((BX,BY,RADIUS,INDEX))
LR_TEXT((X,Y,TEXT$))
Sprite as LR_SPRITE pointer=LR_CreateSprite((SpriteINDEX,Xpos=0,Ypos=0))
LR_DeleteSprite((SpriteINDEX))
LR_PositionSprite((SpriteINDEX,XPOS,YPOS))
LR_SpriteX((SpriteINDEX,XPOS))
LR_SpriteY((SpriteINDEX,YPOS))
Result=LR_GetSpriteX((SpriteINDEX))
Result=LR_GetSpriteY((SpriteINDEX))
Result=LR_GetSpriteWidth((SpriteINDEX))
Result=LR_GetSpriteHEIGHT((SpriteINDEX))
LR_SpriteDEPTH((SpriteINDEX,Depth))
Result=LR_GetSpriteDEPTH((SpriteINDEX))
LR_WriteSprite((SpriteINDEX,X,Y,PaletteINDEX))
Sprite as LR_SPRITE pointer=LR_SPRITEPTR((SpriteINDEX))
LR_DRAWSPRITE((SpriteINDEX))
Overlap=LR_SpritesOverlap((SpriteINDEX1,SpriteINDEX2,Method=1))
LR_WRITEFONT((ThisCHR,X,Y,Palette_INDEX))
INDEX=LR_READFONT((ThisCHR,X,Y))
LR_CreateFONT((Width,Height))
Address=LR_GETCHRPTR((ThisCHR))
LR_Line((xpos1,ypos1,xpos2,ypos2,PaletteINDEX))
LR_WriteToScreen((x1,y1,x2,y2,SrcPtr,SrcModulo))
LR_ScaleWindowToDeskTop(())
Download
Attached