October 26, 2021, 04:12:13

Author Topic: Sokol Wonkey tests  (Read 90 times)

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2483
Sokol Wonkey tests
« on: October 25, 2021, 08:20:38 »
OK. for anyone interested in something more low level. Sokol is an interface library built for minimal low level access to hardware - graphics, sound, timers, etc. It is built primarily for writing emulators for 8 and 16 bit systems.

Here are the current online samples
https://floooh.github.io/sokol-html5/index.html

and also some of the emulators built with it
https://floooh.github.io/tiny8bit/

Wonkey has the base sokol interface along with some of the basic tests. they are a bit strange as you are ditching virtually all the modules which makes wonkey (mojo being the main one) and using Sokol instead. So all of the class systems for windows events etc are gone.

But I have started a tiny project to put back the general use from mojo into a wrapper that has handling for windows, events, color, etc. The good news is it is bearing some fruit with graphics and windows. There is no 2d component, just the bare 3d hardware, but what is really interesting is support for both windows gl and macos metal!!!!!!

Here's a shot of the basic rotating cube:


file sizes are tiny 500k. I've been tinkering and found out how to add images and also how to reference them via spritefonts. So this means basic 2d sprites with color can be done. E.G. This is me writing pitfall from scratch - adding needed method to the core and debugging as I go
First the code just using the main onrender method showing it's power:
Code: [Select]
method OnRender() Override
OnUpdate60()

' BGColor( 0.2,0.2,0.2, 1 )
BGColor( Color.PicoBlack, 1 )

' Print Height
sprites.Begin( state, 160,192 )'Width, Height )


sprites.Draw( 0,  0,0, 160, 48,  Color.UILeaf )
sprites.Draw( 0,  0,48, 160, 64,  Color.UILime * 0.8 )
sprites.Draw( 0,  0,112, 160, 16,  Color.UIYellow )
sprites.Draw( 0,  0,128, 160, 16,  Color.VicKhaki )
sprites.Draw( 0,  0,176, 160, 6,  Color.VicKhaki )

sprites.Draw( 38,  32,48, 8, 8,  Color.XamBrown )
sprites.Draw( 0,  34,56, 4, 56,  Color.XamBrown )

sprites.DrawWH( 36,  2,1,  0,48, 80, 16,  Color.UILeaf )
sprites.DrawWH( 36,  2,1,  80,48, 80, 16,  Color.UILeaf )

sprites.DrawWH( 96,  2,2,  38,111, 84, 18,  Color.UICyan )
and now and image:


Sokol does have sound via miniaudio - but I have noticed pops and clicks, so may do something else via a different threaded system.


Offline Baggey

  • Full Member
  • ***
  • Posts: 198
Re: Sokol Wonkey tests
« Reply #1 on: October 25, 2021, 17:10:38 »
Interesting. The code on Sokol is C-type but your example is Blitzmax like.

Im up for BETA testing! Especially if i can write Emulators with it  8).  Maybe i could Re-Write SpecBlitz for "WONKEY"  :P

Kind Regards Baggey
« Last Edit: October 25, 2021, 18:37:16 by Baggey »
Currently Running a PC that just Aint fast enough!?
ZX Spectrum 48k, NEXT, C64, ORIC Atmos 48K, Enterprise 128K, The SID chip.

Jesus was only famous because of his DAD.    Resistance Is Futile! The code will be assimulated!

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal