all right
we're live i suppose
uh let's do something
i know something interesting so i never
actually implemented a text editor
before
so maybe we could try to end it we could
try doing that why not
so let's see how it goes
um
i think it's going to be a graphical one
uh
could use this deal for that i could
probably use this deal for that
hello chan who hello latinos verdes
welcome to the stream
near me hello hello
hello hello everyone how are you guys
doing
okay gun so
i don't even know how i'm gonna call it
so what's called t e
uh so it's gonna make that scene
and let's see
flags uh to e
minded c so i don't know if i'm gonna
link with anything so if it's gonna be a
graphical text editor so we're
definitely gonna link with something
with at least sdl and maybe opengl
it just depends on how we're going to
render everything
uh for now i'm going to just probably
use sdl
uh maybe later we're going to switch to
opengl
and of course we're going to basically
write our own phd thesis
by looking up glyphs in the shader of
course we're going to do that as well
don't worry about it
so extra uh
so it's going to be standard it's going
to be simple 11 then we're gonna do a
pedantic
uh and uh also gonna include the debug
information
uh hello good welcome how are you
um so maybe for now i'm not gonna do
anything in here
so this is gonna be something like this
right
so and te is basically hello world
all right let's actually uh link with
sdl and make the
usual sdl dummy project
so i don't quite remember hey it's not
main it's rather compile
package config list
all graphics is it is it still too uh
okay it is this zotero okay so package
config
uh see flex seal two libs
uh package config uses
and definitely will need the
mathematical library at some point in
here
that's for sure that's for freaking sure
mate
um all right
so uh let's do something like this
it's gonna be sdl2 let me just say deal
with h
yeah usually when i work with zl i
create these functions they check for
codes and pointers and stuff like that
so basically
uh sdl check code
right which accepts the sdl code and
basically panics
if the uh base if that code is negative
because that's the indication of the
uh sdl error so it's like a usual thing
that i do
so different f standard error i'm gonna
say sdl error
and to get the error then then like this
like this and then here we're going to
exit this
stuff and similarly i have sdl check
pointer which accepts a pointer for the
sdl functions that return pointer right
and we check if pointer
is equal to no right so we don't
error
and of course we're returning that
pointer afterwards
right we're turning it afterwards um
okay so this is going to be sdo in
it uh maybe i need to look up
sdl to think
so that's the that's the function right
so sdl init sdl init video i think
right as well in it video or maybe it's
a video in it
oh it's actually in its video
uh here it is here's right there
[Music]
and i can check the exit code of the
center i think in the end we can
actually quit
the sdl all right so if i try to compile
this entire thing is it compiling it
seems to be compiling
and yeah it doesn't do anything because
it's just like you know initialize this
sdl and just quits
instantaneously make yourself hello
uh sdl create windows so
how can we create a window
create window uh
where is it defined
so it's probably defined somewhere here
let's actually grab this entire thing
[Music]
up the looks it thank you so much for
which prime subscription i don't know
why
i literally wrote like two lines of code
so far
of this text editor but thank you uh
for the for the twitch prime
subscription even though
i do not deserve it but thank you so
much um
all right so let me see
uh i don't know how we're gonna call the
text editor does anyone have any ideas
on how to call the text editor
uh put your ideas in the chat i'm gonna
grab uh some water and i'm gonna be back
um okay i actually have an idea how to
call
my text editor
maybe how to name how to name my text
editor
so
uh another sub from banana way future
uh thank you thank you so much
uh i really appreciate that even though
i don't deserve it but thank you
uh pmax
okay um
it's got uh edit a determinator that's
like
actually pretty long so the thing about
the editor is that you want the name of
the editor to be short because
that's the thing that people are going
to be quite often
um typing in the
[Music]
hello ted that actually sounds pretty
interesting is it isn't already taken
i think it's already taken
[Music]
aptiget is so useful like empty search i
mean it's
thank you so much like how is that even
a useful
search uh holy [ __ ] uh
okay so can i install
uh i'm gonna just try to try to install
ted uh okay that is not taken uh we can
try to look up on the internets
ted editor it sounds like something that
yeah it's already taken
so oh to be fair
what the hell is that please open ted
file by clicking ah
[Music]
nope a brand new advanced text editor
and three
tad notepad well i mean it's a ted
notepad it's not called ted
uh so
[Music]
word processor okay
uh all right it already exists
um already taken
it's already taken it is what it is and
it isn't what it isn't
how do you build oh it doesn't even have
configure okay
um
[Music]
i wonder how long it's going to build
shouldn't be that big
[Music]
um
[Music]
so it should be
short and sweet
[Music]
i don't like said sounds makes it sound
like it
said we just uh i don't know
it actually sounds okay maybe we can
call our texas
no
no whatever so we still can't come up
with a good name
um so we're gonna call a text editor for
a while
then we'll see we'll see we'll see how
it goes
[Music]
okay so this is going to be zero uh
800 by 600 uh and what's going to be the
flags
for this internet thing uh
all right
so create window
and the flags um
so the window has to be resizable of
course right
the window has to be resizable uh scp uh
and the next thing we need to do we need
to create a renderer for this thing
still
create a renderer
so here's the renderer
so we're going to provide the window and
then that
and of course our thing is going to be
accelerated
uh so it's going to be a render
so where are the render flags
uh so this is gonna be accelerated
yep yep
okay so that created the renderer
so after that i suppose we need to
organize the event loop
uh it's going to be something like this
and then
while not quit
and let's study for this kind of stuff
uh it's the elephant event zero
initialize it
while sdl whole event
like this and if we encounter
an event that is
um that's the awkward
so by the way i don't remember
for sure but i rather remember
that which case in jai is literally like
something like if x equal to something
uh is it not uh yeah
i think it's something like this and
then you have just something like 10
or then another one and so on and so
forth
which is actually very weird but at the
same time
a freaking genius
you know why because one of the
problems that i encountered by the way
through throughout like programming in
different languages
is a transition from if to switch
has anyone encountered that problem
right
the transition from if to switch
because initially you like write some
code
and you check for uh like x to be a
particular value
right and then you realize that you want
to check x to be
more than one value right and you have
two options you can actually append
uh more things in here right only or you
can transform it into a switch but to
transform it into a switch you have to
change it to switch then like rub it
like that then remove that then move
this entire thing to
like inside of this stuff and so on and
so forth and it's so
painful in all of the languages
especially in rust by the way
as it introduces like this e flat which
is basically pattern matching
but with a completely different syntax
than match and transitioning
from e-flat to match is actually
extremely painful
uh but it's quite often needed so what
syntactically gia does
right so if you have a condition like
this transition
from if to switch is as simple as
this this index is weird
but at the same time it's freaking
genius
don't you think because it's actually
quite often
uh that's something you you want to do
right so you have initially had if
and then you transition to switch and
syntactically it's as simple as just
taking that thing moving it down here's
a switch
it's a switch now and you can append
more values in here right there we go
and you can go back uh by moving it here
you don't really need to modify too many
things
this is freaking genius if you think
about it
it looks weird at first but as ras
developers say
you just have to get used to it just
have to get used to it
the language is not [ __ ] you just have
to get used to it anyway
so um
it is kind of cool actually it's
actually really well thought out
so
[Music]
so this is gonna be quick and this is
gonna be true
so we need to actually clean the screen
first right in any
like event loop iteration loop you first
clean the clean this thing
um
all right so this is going to be
something like this dl2
uh and then we're going to grab uh our n
uh how do we do that i don't remember
it's something like um
sdl uh set
uh cola let's set cola here we go
uh set render draw color this is the
function that i wanted
not the function that i deserved but the
function i needed
if you know what i'm talking about chat
chat tell me
tell me honestly do you know what i'm
talking about
i'm sorry
uh so now i need to do
clear right so some sort of like sdl
clear
uh clear is it the render clear
yeah it is very clear uh
so it's going to be sdl extern
scc and this is going to be something
like this
all right so we clear that and then we
need to do present
right uh let's do the grab
present i'm gonna remove this entire
thing
yep so that's the thing we need
[Music]
boom so i think presented actually never
fails right
it's not
all right so let's make the color red
so we can instantly see that we're doing
uh things correctly
uh and let's recompile the entire stuff
and
uh run the application there we go we
got a window
18 minutes into the stream we already
got a window this is already half
of the way into a text editor isn't that
amazing i think it's getting [ __ ]
amazing
can your web framework do that
uh so all right so what's going to be
the next thing
got coder you know what you're not
actual gut putter i guess i don't know
maybe not i'm actually not good cooler
i'm just just an idiot on the internet
uh so it's not going to be a terminal
editor
what do you think it is some sort of
disease
sorry i already made a joke before
so it doesn't need to be terminal it's
not the disease
uh uh fun it's not it's actually not
funny terminal diseases are not funny
i'm sorry it's it's really insensitive
for me i really apologize
for saying that uh so we need a
font um we need a font
you know what i'm talking about you know
what i'm going to use the phone that i
use everywhere
my my favorite phone uh like a bitmap
font
comic sense and
probably what is the how is the
um free comic sense it's called
fc uh list right so we have fc list
and then if i grab this thing with uh i
comic right so where is the comic
um so bold angular
there is a regular one okay so
can i just copy this thing here so now
wait a [ __ ] second i'm in a wrong
window this is not what i wanted
uh okay so fc
list um comic space is there a monospace
version of it i have no idea
okay there is i don't see a mono space
version to define
uh do you have mono no there is no
modern space version
well at least i don't have it maybe it
does exist somewhere
but i don't really have it
so i'm just thinking do i want to go
into the like a ttf rendering right now
or
do i want to just use like uh like a
whatever
uh sounds like i want to use whatever
right so let's actually go with the
bitmap phones
now let's go with the bitmap uh
phone again
[Music]
dumps and phone again so i probably need
to generate some arrays and [ __ ]
right so uh i suppose i'm gonna actually
put this link in the description right
so just in case
uh fond game thank you that i'm using
[Music]
so uh let's go oh
don't sound fun again branch
get fetch prone origin
bit merge origin mustang all right
so this thing is written in rust by the
way
if anyone is interested do we have any
rust developers in the chat
do we have any rust developers in chat
look at that this is rust
uh by the way i have a question for you
guys what do you think about rust
uh tell me like honestly but honestly
like
your actual feeling towards rust what
do you think about rust tell me i'm
really really interested
so uh let's let's compile this thing
alright c formed uh
again rs uh and
it's going to take some time
and what the [ __ ] oh this is because i'm
supposed to use me okay
by the way i'm i'm building a rust
project with make
seriously i'm not even joking this rust
project is built with make
chad tell me how do you feel about it
how do you feel about me not using cargo
and using make files does that make you
mad
tell me tell me everything tell me
everything what you think about it
all right so uh let's go so
which font we're gonna be using actually
uh so again sharp mob
old school so i'm gonna be using this
one i kind of like this one i use it
every time
uh in all of my projects even though it
doesn't fit anywhere but i kind of like
it because it's super simple
uh and i suppose what i need to do i
just need to call font again
um yeah it's going to be chart map old
school
uh white and that generated a c uh
rust code um i suppose what i want to
generate is actually
c code right so this is the c code
yeah this looks like a c code can i um
oh it's compressed
actually
all right so can we can we do something
uh yeah we can probably do
a roll do not apply any compression to
the font yeah let's actually do the raw
version of the font
so the raw version of the phone is
rather big
you see it's not compressed whatsoever
it's totally fine because we're not
doing embedded or anything like that by
the way can i just do something like x
clip
and copy this entire thing into into my
buffer and just copy paste
in into somewhere uh so let's put this
is gonna
and i think yeah okay i actually can do
that that's actually really cool
so here is the font compressed
font um
uh if not defined font dot h
all right so we're going to define this
motherflipper that we're defining this
parameter flipper and then it's going to
be
end if this is going to be a font
and i'm going to include this entire
stuff
into font.h and we're going to have
a very simple um
very simple array of bytes that we can
probably
make a texture out of uh but i need to
know
the width and height of this structure
so
char map old school so width and height
is 128 by 64.
so let's call this thing a font
and this one is going to be something
like uh font width
uh 120 28
and 28 and font height is uh
64. right and on top of that we can just
say something like font width
and font height there we go so we have a
width and height of the point
[Applause]
so
now um isn't going to compile that one i
have no idea
[Music]
so we now need to create a texture out
of the phone do you know what i'm
talking about chat you know what i'm
talking about so you know in sdl uh
we have textures oh ceremony hi
erdem
wait wait ah great texture
so yeah this one so we're gonna provide
the render we'll need to
figure out the format format uh
and width and height and so on and so
forth um so the question is how can i
figure out a format i have no idea so
let's just copy paste this code
and just put it into into my project
right people always ask me zozin
how do you know so many things bruh
look look look here's the here's the
mouse
right click copy
boom you don't need to know anything
it's that easy
see like why do you think you need to
even know anything just [ __ ] copy
paste
and even better so have you guys heard
about github
co-pilot have you guys heard about this
[ __ ]
you don't even need to do that anymore
you just install this magical piece of
software and it just like copy paste
code for you
it's like automation of copy pasting
tell me chad what do you think about it
tell me what do you think what's better
github co-pilot
or rust what do you think which one is
better
and which one is going to win
that's a very interesting question
actually nobody actually thinks about it
too much what is better
rust or github co-pilot
anyways uh so let's continue we're gonna
uh put a renderer in here and the
question is how can we
uh generate a format one of the
enumerated
values in pixel format in them
um pixel uh format unknown
nice format by the way nice format
index eight uh
[Music]
is there anything like a grayscaled
so i feel like
i feel like we need to use index 8 but
i'm actually not sure
so what the [ __ ] is this [ __ ] um create
an open gel texture
with as a byte per pixel of one and all
masks of zero okay so maybe that's
precisely the format that we have to use
uh any alternative to sdl2 um
opengl is suppose
uh depends on what you what you pre what
precisely do you need from
seo too well how do you use it do you
use it as an initializer for opengl or
vulcan
or do you use it as a i don't even know
like a lot of people just use it as a
initializer for opengl and vulcan
but it has a capability of rendering
like its own things in a cross-platform
way but it's actually super limited
it allows you to only render rectangles
and
that's it i'm not sure like
these kind of like pieces of software if
you just like look at them compares them
side by side right so you have sdl-2
um ray leap glfl and openglw
like are these things even
interchangeable
okay glfl opengl
is a graphics api graphics
api used by all
of the three below first of all
opengl is a graphics api that is used by
all of the three below glfl is
simply an opengl initializer
initializer that's it right
so sdl um
is a little bit
more than just an opengl initializer
just a little bit more it allows you to
feel rectangles and textures
in uh in a cross-platform way but that's
it a ray lib is
full-blown game development
library and almost
uh and almost a game engine
so is this thing are even comparable
like how can we even compare these four
things
uh so i would even say ray leap is
basically game engine
as a library that's what it is um
and uh what's interesting is that i
think we even like looked into ray lieb
at some point
[Music]
and yeah it's actually kind of difficult
to use opengl without
glfw or sdl and stuff like that
so uh searching daily
ray lib
yeah so this one is interesting it's
actually like this is a second part but
it's actually not really a second part
so you can actually watch it separately
uh as you can see it's my brother it was
reviewed by my
brother
i'm not running this channel oh no okay
so it's actually there's several of us
in there
uh all right so um
let me see it's gonna be description
um okay um
array lib uh stream
so we even looked into it and uh
yeah i think i think there's even source
code somewhere
using brothers for producing the content
if you know what i'm talking about
[Music]
um
pew pew 3d the game that i wrote in ray
leap in one stream is literally
called pew pew 3d uh
i have no idea why is it cool like that
but yes it's a popu
3d i'm gonna put it in the description
if you're interested in this kind of
kinky [ __ ]
uh all right i didn't really want to do
that but
i did it anyway so okay so this is the
text editor
and i can go into pupu
i don't even have it anymore in here is
it in prop
yeah it is in here it is still in here
and apparently it is oh yeah there we go
yeah you it's a
it's a gay corridor that's what it is
uh thank you for raiding mr halsey
welcome to the gay corridor game
um so yeah uh
so that's basically what you can do with
the with this library
uh yeah
so um
is this a texture yes it's a texture
it's a really innovative way of reading
the text
[Music]
shooting cubes yes yes yes kawaii
[ __ ] this
all right so
yeah so i'm gonna keep all that in them
in the description
come in the kickoff
so yeah anyway
so this is the stuff access what we're
going to have within the access
access texture access all right
um static change is really not lockable
okay
so we're just going to make it static
so width and height is going to be
font width and font height
this one is going to be a texture and
this one is going to be scp and scp
stands for
secure contain protect yeah that's what
it stands for uh it actually stands for
sdl check
pointer all right
so uh let's see if we managed to even
compile this entire [ __ ]
uh yeah we wish to compile it can we can
we run it can we run it
and uh pelletized textures are not
supported
the [ __ ] uh so that means i
chose a wrong format how can i choose a
better format
because this one this [ __ ] is kind of
sus
not gonna lie because i have
one byte per pixel but the only things i
can
have in here are like eight bytes per
pixel something like that
i don't freaking know um
so is there any way i can
you can do something about that
so rgb444
so one thing i can see is basically
expand
my uh my image
into like 32-bit formats or something
like that
um we can try to google that sdl
one byte um
one by texture right
create texture update uv texture
pixel format
[Music]
maybe we can create our own pixel format
i suppose
oh wait a second oh [ __ ] i'm an idiot
first you have to create the surface not
the texture oh my
god oh my god
uh copper cased it thank you thank you
so much for 22
months of tioram subscription uh almost
two year by the way
almost two years thank you very much uh
really really appreciate it
um holy [ __ ] why the [ __ ] do we have 230
viewers well thank you thank you
everyone for watching uh
the game of a gay corridor uh so
is that is that's why why are you
watching right is that why you're
watching is that entertaining
okay cool all right so we need to create
the
surface first just
still create service uh we need to
create rgb service
um
[Music]
all depth g mask
b mask and so on so forth
[Music]
great rgb surface uh
[Music]
i suppose from we need to use from yes
we used to use
so pixels um pitch is the
is this stuff um
the depth of surface in beats
what i'm thinking is that i think we can
just set
all of them to 255 um
and yeah that's gonna be that's gonna be
the way it goes
alien pls is it lmps
all right
all right so um
first thing we need to create we need to
create the surface
all right recipe
so font uh is actually a big one font
width font
height so depth is going to be what
8 8 bits and the pitch as far as i know
is uh in bytes okay so that means it has
to be
phone to width and it's already in bytes
so we don't have to do anything about
that
so this one is going to be 0x ff and i
think that
should be enough i think that will
create the texture appropriately
uh we'll see about that so are you ready
uh we need to compile this entire thing
so it's gonna be something like this
so font uh
discards const oh [ __ ] why
wait a second oh why the hell does it
accept
void and wants to modify it
why hmm
the functional press must
[Music]
excuse me why the [ __ ] this function
wants to modify this buffer
like because i'm just creating can you
just copy this [ __ ] into into your own
buffer and modify it there
this is rude in my opinion if the
function modifies my buffer
it's kind of it's kind of sauce not
gonna lie what a good thing isn't it
sauce
uh copying i mean what's wrong with
copying though
um i mean it's not that slow if you do
it once per
lifetime of the application right so i
want to copy it
once before doing the main loop right
and i'm not copying anything in the main
loop
um right so it should be actually
defined
[Music]
should be totally fine
so you know we're going to look into the
source code of sdl
so let me let me quickly do that uh it's
going to be third party do we have a
source code for sdl uh i don't see the
source code for sdl what the hell
um let me quickly find
find type directory and name is going to
be actually i
name sdl may contain sdl
and the max depth is gonna be one
right so and we're gonna be this gonna
be slowly increasing the depth
slowly getting deeper and deeper
uh right slowly now depth is gonna be
three
going deeper and deeper
and apparently we don't have a source
code for sdl yes yes we don't have a
source code for sdl we'll have to
download the [ __ ] okay
let's go ahead and download the sdl
search script
ah so um so there's a bunch of releases
in here
and now we're just gonna grab this thing
i'm just gonna grab this thing
third party dependency yeah but sdl is
like a third-party thing
and i don't know
it's got to be
[Laughter]
well basically yeah the problem with
find is that it's
actually doing dfs and sometimes it is
very slow
especially if the folder that i'm trying
to find
is like next level right and it's just
like constantly missing what i'm trying
to find so i'm doing this scuffed dfs
so this is the
this is the best way to describe it like
i look like uh yeah so this is the scuff
dfs
i have a source code for gcc what the
[ __ ] i need gcc
in my life go away gcc nobody wants you
it's recursively deleting gcc that's how
much time it takes
okay
[Music]
can i can can you just not do that i
mean
just come on can't you just do something
like this
and yeah it's it's it's removing gcc
recursively that's
holy [ __ ] it probably has a lot of small
files that's probably what's going on
hmm slow hard drive probably or maybe
gcc just generated [ __ ] ton of [ __ ]
[ __ ] tone of [ __ ] slow tape
oh yeah uh it's finished look at that
finished uh
did it actually free and i it wasn't
even that big
it wasn't even that big okay it
came to the completion all right
so what i was trying to do does anyone
remember i was trying to find this
function
okay we have a c okay let's go ahead and
find this motherflippa uh
where is the definition for this
function
so here it is it uses pixels right
so and it sets the pixel
[Music]
i see you see what's going on
it takes my pixels and it simply moves
them into the surface
it literally moves them it performs what
we call in
industry a move semantic move
yes it's a it's a move semantic but
unfortunately in c there's no move
semantics so we never know that it was
actually moved
uh yeah it actually performed std move
yeah let's if i programmed in the rust
if i programmed us by the way what do
you guys think about rust uh have you
had
have you guys heard about this language
have you already rewritten everything in
that language
so if we use the rust rust would
actually warn us about this kind of
thing but we're not using rust
unfortunately
okay so uh yeah i guess
we
i guess i can just make it modifiable
why not why not i don't mind this thing
to be modifiable
sure it's my memory uh it is
my memory i can do whatever the [ __ ] i
want with it
okay so i have unused surface now if i
try to run this editor uh
unknown pixel format
cool hmm
this is rather sus this is rather sauce
is this a known format
one what if i put something like 32 in
here would you would you be happy with
this format
would you be happy with this format no
it's still not happy with this one
uh so where is it failing by the way
where is it fading oh
i've got an epic idea i can turn these
things
into macros at least i can try
no i cannot do that um
we have some mask peppa the newbie
uh yeah sure but
i mean i have a monochrome image and
[ __ ]
so
it uses this today
i just don't want to do okay so i guess
we're doing this to be i
i guess we're doing this today i'm sure
um because
it's taking too much
just hoping that maybe i can just create
that thing
i cannot so let's do std image
[Music]
so this is going to be the row thing and
uh
yep yep that we get we're gonna do that
and i'm gonna simply yeah let's just
remove this stuff
stb image dot h
uh autocomplete the beggar auto complete
oh you mean okay let's see what you mean
so what i'm thinking is that maybe we
can actually create something like a
surface from a file right then we can
provide the
file path so this thing is going to
return a sdl surface right so we have a
sdl surface
so maybe there's also some example that
we can
uh download little like copy paste from
here
yeah i think i think let's try to use
that
um
this is going to be something like this
um
x y n and this one
is actually pixels i don't really like
to call it x and y
i think it's more of a width and height
if you know what i'm talking about um so
this is width this is height and i want
to have four components in here
in that example in here so required
format
is not even specified stbr rgb alpha
oh stb has like predefined constants for
formats and [ __ ] i didn't know that
that's actually pretty cool wait a
second
yeah okay
okay that that makes sense all right all
right right i like that
i actually like that so yeah rgb alpha
because it's a little bit more
descriptive so at least it shows the
intent you know what i'm talking about
right
so the number four number 15 doesn't
show the intent
right but the this specific constant
actually shows
the intent uh and it makes the code
readable and it's all about
readability right we're not writing
codes for computers
right we're writing codes for other
humans to read
computers don't understand the code they
need the code to be processed into
native
uh assembly to execute they don't give a
[ __ ] about naming and stuff like that
right so it's all about readability
readability is the most important thing
right and we prefer the code that shows
the intent rather than just some
stupid numbers
if you think about it like [ __ ] like
github co-pilot
is basically machines writing codes for
other machines in a form
that is readable for humans
have you thought about it like think
about it machine
writing code to another machine
in a form that is readable for humans
but not readable for machines
there's so much redundancy involved in
here
why not just make a program that writes
programs for other machines in assembly
in native code directly why even
involve humans in here you see what i'm
talking about like why
it's so redundant um
yeah i didn't i understand yeah it would
be better if
it was just generating the the binary
directly but it doesn't
uh anyways so we also need to check um
stbi even has a failure reason holy [ __ ]
i'm actually learning about stbi from
this thing okay so what does it return
oh my god this is so cool i didn't know
that it has a failed
reason what is the failure reason what
is it usually set to
my god um
all right so maybe we can do something
and also there's sdl log
uh not a volleyball subscribe with
twitch prime for
13 months my god thank you so much for
uh more than a year of twitch prime
subscription thank you thank you thank
you and welcome
to our epic github co-pilot club that's
right
uh so what the [ __ ] is the sd log though
uh oh yeah sdl has a log
speaking of right what's
uh what's the level of the library of
sdl library it has
a logging system uh anyway
so but we're not gonna be using that
if pixels equal to no right if pixel is
equal to null
uh what we're going to be doing in here
we're going to be
uh f printf std error all right so
this is going to be something like error
could not
uh load the file s because
of another s right so this is going to
be file pathways
file path
so and what's going to be the reason the
reason is stbi failure reason okay
stbi failure is an ass
ass gucci hyper
[Music]
so here's the reason and um depending on
the order of these things
yeah i guess we want to do something
like this as well right so
i'm just going to be copy pasting code
uh
your required format is that otherwise
but the quiet format is actually alpha
what the
why do we have this code this is so
weird this thing has just been weird
i think
so we know for sure that we do have an
alpha in there
and that's why pitch is gonna be just
that
uh you see i'm just copy pasting code
from the internet i don't need to know
[ __ ]
uh and then we are creating this stuff
right just creating this stuff and we're
going to be returning it
from here but before we can return it uh
we also have to check
that it's a correct thing to return even
so this is width and height so this is
going to be pixels this is going to be
width this is going to be height
uh and everything's going to be all
right
if you know what i'm talking about uh
yep yep so here we actually revert this
kind of stuff we
don't really need to so if it's equal to
that
um yeah this is dumb we're not having
a different format in here right so the
required format is that specifically
uh yeah what what the [ __ ] is this code
like why
like yeah holy [ __ ] this is actually
funny look at that
yeah if the uh indiana says that we're
gonna do that otherwise we're going to
do that this is actually pretty cool i
really like that
uh to be fair on top of that we could
have actually done
u hint 32 right in 32 and because of
that we can make it
const right we can make it const and
this one is going to be const you
in 32 there we go uh because we don't
need to reassignment of this stuff and
then we can make it consider as well
they have a go there's no need to
to make it uh like non-constant or
anything like that
uh you know what i'm talking about you
know what i'm talking about yes yes yes
that's what i'm talking about
the tool i'm talking about
all right so let's try to compile this
entire stuff is it gonna compile
is it gonna compile uh it doesn't even
compile because of stb
it's a classical stb stuff uh
conflicting the qualifier um
excuse me why is this conflicting
oh because i actually define this stuff
okay thank you very much
[Music]
with undeclared okay so all right so
maybe i should actually call this thing
width and height
width and height w
no u double me
and w
so and we don't have to do that [ __ ]
anymore it doesn't exist
finally i made it managed to make this
[ __ ] compile holy [ __ ] that was hard
you know what else is hard
so um let's actually
fix some of the warnings in sbi
so i think this one can be inked
quite easily and this one
being unused i i think i remember that
once so it's basically in real location
is to the ira location of our nation
um so where is the implementation
yeah yeah um i think size yeah so here's
the size
so all size is actually not used so you
have to do something like this
so every time i use stbi i have to fix
a stb image like that because uh
contributions to these libraries are not
accepted anymore that was actually fixed
long time ago
but um yeah sean doesn't look into the
contributions anymore
i mean it's fair enough he actually
distributes these libraries for free for
everyone so i
don't i have zero complaints about that
seriously because
uh the ratio between the price of this
library and the quality
is [ __ ] insane it's the best ratio
that you can find in the market
seriously absolutely free public domain
and so easy to use you can just slap it
into your project it's just [ __ ]
amazing
so just because it has some a little bit
of warnings that i have to fix all the
time it's just like whatever
[Music]
okay i'm gonna sneeze by the way
all right so um
okay so we created the surface i need to
create a texture from the surface sdl
uh texture from surface right
texture from surface
okay how do i copy paste i'm trying to
praise this game
uh all right so we're gonna be doing it
like that
um
so this is the i never actually run it
so i should probably run this into a
thing so it's gonna be surface from
a file right so i'm gonna put it in here
uh font surface right so this is going
to be front surface
uh in the file path we don't even have
it in the file path so with some let me
actually go to phone again
uh and i'm going to be just pasting it
in here
okay let's go and try to recompile this
i think and
it's successfully loaded okay i'm super
happy it actually successfully loaded
everything
uh so yeah now we need to create the
texture
so this is going to be font texture this
is the
phone texture we're going to provide the
renderer uh
remember and the surface right so
and we need to check if this entire
thing actually returned
uh everything appropriately no it didn't
because it has to be formed
on texture and it seems to be working
all right all right all right we managed
to load
the um
they beat uh the sprite sheet right we
managed to turn it into sdl surface
and we managed to turn sdl surface into
sdl texture
which means that we can slap that
texture onto the window
right let's try to slap it onto the
window i think it's something like sdl
a render copy right so it's the sdl
render copy
uh so that's precisely how you do this
[ __ ]
so we provide the renderer then we
provide the formed
uh texture and we need to provide the
um sdl rectangle okay so let's actually
call it something like
font erect all right and it's going to
be something like that and of course we
want to check
the exit code so we want to check the
exit code
so as the rect is going to be formed
correct
and uh this one is going to be x zero
and then y is going to be zero w is
going to be
um oh man this one is actually very
interesting so i know that it's 128 but
uh what if it's something gonna be
different so we need to extract the size
of this thing
oh we already have the size in the
surface don't we
so if i go into user include sdl2
uh and i'm gonna grab for this thing in
there you know
uh grab it wrap it like it's hot
grab it like it's yx i'm sorry so it's
gonna be w
and h and you can just grab that [ __ ]
from there right so
that means i can do font surface
uh w then font surface
h and there we go now i know precisely
the size of all of that [ __ ]
[Music]
and let's try to do it like that and
is it going to be working is it going to
be twerking a boom
first try look at that look at that we
managed to render that
sprite sheet isn't that amazing i think
it's got them [ __ ] amazing holy
[ __ ] [ __ ]
subscribe if you are excited if you are
as excited as i am uh
alright so let me let me see what we
have in here
so maybe we want to make it a little bit
bigger um so
all right so this is a phone direct and
sdl erect
uh correct uh maybe it's called output
rect
it's gonna be something like uh x
zero w
yeah and then font correct w but
multiply by
uh five probably and then something like
h
also something like that so we're gonna
have something like output
correct uh and [ __ ]
why are you not working
epic [ __ ] epic means
all right so uh now we need to actually
be able to render the text you know what
i'm talking about so
i implemented that kind of stuff
multiple times already so i think the
easiest way would be
to just have a function um
render text right so it's going to be
simply render text and it accepts the
text that you want to render
right uh and probably the position where
you want to render it like right so it's
going to be int
x and n into y and also some sort of
like a scaling
uh also some sort of scaling uh cream
misses
uh subscribe to tier one thank you so
much for watching subscription thank you
thank you thank you i really appreciate
it
so i think we need to actually implement
a vector
mathematical vector library you know
what i'm talking about because we're
gonna do
we're gonna be doing like a lot of
geometry a lot of linear algebra and
[ __ ] like that
and we need a pretty strong library to
do this kind of [ __ ] you know what i'm
talking about
um it's supposed to be cut stop exposing
me i come out
you're exposing all of my plans uh okay
so
god dammit
to be fair at this point any of my
projects is
a immediate ui experiment at this point
all right um
so um i don't know um just a second i
need to actually
grab some water uh in the meantime what
do you guys think about immediate uh
ui has anyone actually used this thing
what do you think
about i'm gooey okay
[ __ ] i didn't have any water filters
[Music]
i'm good does it have a javascript of
course it does
uh gripping on the influence
huh very interesting um
it's not cute
but you are cute
so i need to wait until my water
actually finished later
uh so yeah
let's actually implement like a quick
vector library so this is gonna be
l a dot h uh if we need to find
la dot h uh i'm gonna define
then and if um
so
and destruct
uh we're gonna have something like
vector two f i suppose and we're gonna
have float
x and y and then just need to implement
like a bunch of uh
vector operation in here uh
so i suppose first thing i want to be
able to do i want to be able to create a
vector
to f right vector two
what's called f uh
y and i also want to be able to create
it from a single value
right so essentially it's gonna uh copy
that value into x and y
uh so and then uh we're gonna do
something like
back to f ed um
a back to fb uh
so add sub mall
div we need anything else add
sub multiply divide
maybe also length but but for now i
think it's going to be fine so that's
that should be enough
um right and let's just go ahead and
implement all of them
be including um this thing in here all
right
so this one is gonna be essentially
the vect to f
x equal to x y equal to
y will this tactile get lexa passer for
smart annotation and syntax highlighting
we'll see
we'll see we'll see uh the winner gets t
that's for sure um all right so
and in here it's gonna work like this
so okay
so we're gonna use a little bit of emax
magic i suppose alright so it's gonna be
like
that boom oh [ __ ] it didn't work e max
magic didn't work
like this and then we're gonna return
vector to f uh a
x plus a b
x a y plus b y
boom and just we just need to go through
all of these places like this and
for sub replace plus with minus right so
it's gonna be like this
uh multiplication with that and division
with just that would you look at that
isn't that amazing i think what the [ __ ]
is this [ __ ]
all right so and that's how quickly we
implemented all that
that's how quickly we implemented all of
that so
now we can operate on on the level of
like vectors and whatnot
that would be amazing i think that would
be amazing
so uh
render text so we're gonna provide the
sdo renderer
renderer and uh so we're gonna provide
the position at which you want to render
the text right um also maybe you want to
provide the color but i'm not sure
how to provide the color what's the best
way to provide the color maybe we're
going to provide the color
as you inked you in 32
so this is going to be the color um
and also we need to provide the scale
right so
basically how to scale the text so it's
going to be full of scale
um on top of that we probably also need
to provide the texture
right so the the font texture so this is
basically what we're going to have in
here
so here are all the things that we want
to provide
which dot it's a designated initializers
by the way
[Music]
um
initializers
uh i think it's the significance yeah
there we go
uh so if you have a structure like this
you can actually initialize the
structure like that uh specifying
which field would equal to what so
you can do it like that uh relying on
the order
of the of the fields or out of order
with like specified names and stuff like
that so it's a designated initializers
um so it's actually pretty convenient
as far as i know c plus plus 17 cannot
do them
um they existed in c for quite some time
already but
the yeah okay uh
it's simple spot 99 or c99 or c90 or
something i think it's cindy's name
so in c plus plus they appeared only in
c plus plus 20
like in a recent standard which is kind
of which is kind of a shame it it took
the c plus plus standardization
committee 20 years
20 years to figure out how to do
this imagine spending
20 years to figure out how to do that
yikes freaking yikes
anyway
uh i didn't even i wasn't even
programming
when c had that feature imagine that
i wasn't even programming at the time um
so i'm gonna just
grab some water and bring it back
[Music]
i'm [ __ ] coming
i came
all right so how's it going everyone
uh i'm good abu gucci with tamaguchi
um is it really 20 years i can't believe
that actually wait a second
so uh requires element solutions to
appear in the fixed order the same the
order in the
uh you can give the element any other
specifier in this structures
uh i think it's c90 well i mean
yeah it is 20 years it's like 21 year
old
the [ __ ] really it took them that much
time
[Music]
um all right so
i suppose we're going to start with the
with a single function that can render a
character
at a particular position right so it's
going to be something like the renderer
uh renderer sdl uh texture
font direct to f position and
actually wait wait wait wait wait um
so here we have we have to actually
provide the text with which one render
um he has
16 and 15 in the same time
50 i mean i don't speak english i'm
sorry
uh hello hello welcome to stream how are
you uh
so this is a position and this is a
character um
so
maybe i'm gonna put a character
somewhere here so this is the character
this is the position
uh then you insert it to color
and then we're gonna have a scale there
we go
coding in c c plus plus while streaming
all program is what dream at least
mine is well i mean c and c plus plus
pretty cool but what about the rust
um imagine actually like streaming and
programming and rust at the same time
holy [ __ ] [ __ ] that would be amazing
wouldn't be i think it would um alright
so i wanna
take this thing so what is the ascii
right so
where is the first thing in ascii so
it's going to be space
uh so we need to do minus 32 so this one
is going to be
um wrong website for that
believe me considering the recent
matters on twitch
this is the right website for that trust
me
this is the right website for that
i remember saying that uh if i ever
gonna be banned
on twitch right i'm gonna do a stream on
chatterbait
considering the current trends i don't
even need to stream on chat rebate i
just
continue doing what i'm doing and
eventually i'm going to do a stream on
the chatterbait
because twitch is slowly turning into a
[ __ ] chatterbait anyway so
cheers then we need to switch the
platform
the naked coder
[Music]
to prefer i'm not in the best shape for
that so yeah
[Music]
so i need to figure out the rows and
columns right so we need to figure out
the rows and column
so this is going to be the column um
and then this is going to be the row
so but unfortunately we already know
what's the font rows and columns right
so let's define them
font rows and font columns
i keep targeting them by the way
uh one two three four five
six seven right so we have seven seven
rows and i think we have
18 columns right so one two three
one two three four
five six six by three is eighteen if i
remember correct all right so it's
uh right right is it is it it's 18 okay
thank you so much
i think i still remember how to do
arithmetics
i'm a programmer not mathematician don't
make fun of me okay uh
don't make fun of me please please don't
make fun
i'm stupid like that i realize that
anyway so here's the index
and what i need to do in here to figure
out the column i just need to
do a mode on the font row uh font
columns right so
this is what i need to do here and to
figure out the row i just need to define
it
uh divide it like that there we go
[Music]
next stop hot tub coding yes
uh hot tub counting
um
i wonder if anyone actually and
ironically programs on chatterbaits
that'll be interesting actually um
maybe i'm going to be the first one who
knows
64.
tap coding yeah okay so
um let's figure out the rest of the
stuff so this is gonna be font
character width all right so that means
i take the font
uh width and it divided by font columns
right maybe it's against
2s which 2s against
childretios
i don't know as far as i know like on
chatterbait it's allowed to pretty much
stream
anything except like illegal things
um so
but they don't really have specific
guidelines on what to stream
you don't okay so here's the thing uh
about the port right um you don't even
need to say
that you are allowed to stream porn and
nothing else
you just basically form your guidelines
so the porn is
allowed and you're gonna end up with
everyone's streaming porn anyway because
if you try to stream
anything else it can be outshadowed by
the port you don't even need to tell
people explicitly
to not do anything else because nobody
won't be able to
do anything else except porn you see
what i'm talking about
you just need to allow it and
that will create an environment where
you don't even need to forbid anything
else
it's just like you don't need to do that
because anyone who's doing anything else
is not going to survive
but despite that maybe somebody's doing
something else on chatterbait as a joke
see what i'm talking about um
all right anyway so
formed char and
all right so here we have that uh we
don't even have that so i need to
include
yeah it's a it's a very philosophical
question right so
technically you don't need to forbid on
a porn website
to post anything but porn because if
porn is allowed nobody's gonna bother to
post anyone
anything else anyway so why bother
why bother
and because of that on platforms like
pornhub people
post videos that are banned on other
platforms right like youtube or
something like that
because of political reasons or
something else
because the platform does not forbid
that
um all right so here we figure out calls
and
rows and uh i suppose we need to
actually start preparing the
[Music]
this stuff right so
zero render copy
today is amazing stream coding while
talking about
pornhub and sharepoint well i did mark
my stream as a mature audience content
okay so
don't blame me right you clicked on this
uh stream yourself
don't blame me okay i warned you
if you didn't expect that well you
should have actually read the warning
uh you know sent by twitch but
if the if the stream marked as a mature
audience
the first time you joined the stream the
twitch will actually tell you
this is a mature audience content do you
really want to watch it and
yeah so you clicked yes so that means
you're okay with everything i sent
here
[Music]
can you show progress so far this is a
very intimate question but
sure is that a good progress
[Music]
hmm
all right it's pretty good progress
[Music]
we can hear you stroking your keyboard
by the way well i'm pretty convinced the
only reason why people watch me is
because of my keyboard like i already
said that multiple times
uh this is a top right keyboard a
happy hacking keyboard and it actually
produces pretty pleasant sound
and i'm actually scared that one day
this keyboard will
die and i have to switch to switch it to
something else
and after i switch it i will realize
that nobody is watching me at all and i
have like like you know
less than 100 viewers and holy [ __ ]
everyone was watching me because of the
keyboard
uh that might happen actually um
anyway so what's going to do
so we're gonna have sdo wrecked so this
has been direct
and this is gonna be x uh keyboard is
some more yeah precisely
process so this is a keyboard asmr so
this is a column multiplied by font
character
width uh from character width uh
this is gonna be a row this is gonna be
height and
up to the ep and then
we're going to do something like this
height so this is the basically the
source we can call it src
um
so this is going to be src
src uh and so what's going to be the gst
these this is actually a very
interesting question
still wrecked dst
so the location is going to be the
location is here
okay that makes sense so i take the
position
x of the position and then i go to floor
so and i need to convert it to integer
essentially right so
and here we need to font character
width and this one is going to be font
character
height fourth starting thing oh thank
you thank you so
much thank you for floor for me uh this
is something that i really needed today
thank you thank you so much i really
appreciate it
all right so and i guess that's it we
also need to probably multiply this
entire stuff by the scale
right and because of that we'll need to
floor this thing one more time
[Music]
so any floor first in the chat
any floor first
cool um so that should be it i think
this is how you render
a single character um
i guess interestingly enough
by the way i implemented
[Music]
all right
i'm really sorry
okay um
i hope it wasn't too loud
i'm really sorry uh just a second
i'm really sorry so we'll see how many
viewers will will actually lose because
um yeah
um well it is what it is um
yeah i'm really really sorry i didn't
didn't do that intentionally
got flipped yeah
that's the scream sound effect yeah
i need a better microphone stand to be
fair um
somebody got too excited yeah i
implemented
this thing multiple times but then it
never occurred to me
that i could actually cache src
you know what i'm thinking about you can
actually encourage this [ __ ]
like you don't have to do that and then
you can basically look up
yeah that's that's way faster but uh we
can do that a little bit later
we can do that a little bit later it
like this is kind of [ __ ] that could be
actually cached at compile time if the
language was decent
right if the language allowed um this
thing to be executed at compile time but
unfortunately in c you cannot do that
um so all right so in here
let's actually try to render a specific
text uh we're gonna be iterating
uh so it's gonna be size t and ester len
uh this is gonna be the text and the
four
size t i what is
[Music]
so this is going to be the renderer then
we provide the font then we provide
the text uh i
and the position is gonna be slightly
different so
it's gonna be the original position
[Music]
though uh with the position right
so we can call it something like this so
this is gonna be a pan
which starts like around in here right
so it's gonna be pen
uh the color is gonna be that color and
the color the scale is gonna be that
all right after we render this thing i
just move the pen
uh x by
uh character font character width
multiplied by the scale right so and
then we'll remove the pen
that should be it effectively
that should be effectively it and let's
see if this entire thing compiles oh
well yeah i didn't try to compile
properly
uh all right so this is the color color
is
unused for some reason okay so that's
fair enough
so to use the color i need to set the
texture mode
i think all right so sdl texture mode
um yeah set texture mode
[Music]
opengl is painless and it's not as much
of a pain in the ass
as for instance vulcan
maybe it's fine depends
depends on the level of control you want
to have in your application so
um so the color is just
you int uh and i suppose i can do it
like that i will need to
shift two bytes right so it's gonna be
eight multiply by two and then
i will have to do something like f there
we go
so this is ssc uh scc
it's gonna do something
[Music]
hopefully that will work
so yep do we use the color now we seem
to be using color now
um conflicting types
oh this is because this thing has to be
called character
right so
and so this has to be called a character
okay finally and what we can do in here
is essentially try to render hello world
right so let's try to render hello world
like this so we have the font
this one is one's gonna be hello world
what's gonna be the position it's gonna
be back to
f uh let's put it at zero right
at zero zero the color is gonna be
uh let's make it red uh and the scale is
going to be
around five right hopefully that will
render the text somewhere there
uh huh so font it has to be font texture
okay
let's put it like that and uh font react
is never used
well why do you need to use that [ __ ]
don't use it then
uh oh yeah now i need to actually link
uh l a dot c
yeah elevated c is it go away it's a los
angeles library
that's what it is it stands for linear
algebra it's not los angeles
here we go it's actually blue for some
reason
um it's very strange but
very very strange why is it blue
uh because i [ __ ] it up that's why
ff then vista stuff okay so
render text and then we render the
character
so suppose it has to be maybe like this
yeah i think it
yeah i think it has to be like this um i
had chemistry thank you so much for
twitch prime subscription hey
thank you so much really appreciate it
now we're talking now it is red
right beautiful we might as well
also utilize the alpha right so
even if i set the alpha to something
else we are not setting properly
so i think to use the alpha you need to
set texture
alpha mod right so there's a separate
function for that
alpha mode
maybe it's rgb another well i mean it is
whatever i want it to be
right because i set the value in here
right and then i parse it in a different
place so
the sender and receiver is me
so it doesn't really matter if it's rgba
or abgr it's just like
whatever i decided to be it's just like
i need to properly parse it then
on the other end um so
let me let me see so it's gonna be that
stuff and
um scc
so this is gonna be the alpha and alpha
is
going to be
the third one
imagine being the sender and the
receiver
it is a high privilege not gonna lie
okay so what i want you to to do by the
way so we recompute
this rectangle every time every time we
render a character but as i already said
it never occurred to me
that i could have freaking catch this
[ __ ]
you know what i'm talking about uh look
at the freaking cash this [ __ ]
talking to himself like a madman
are you talking about me am i not
streaming
am i going crazy am i imagining that i'm
streaming and having 250 viewers
do they do did they go that insane
already
maybe [ __ ] okay
uh can you suggest the text training
technology that sublime text
author used suggest i have no idea what
they used
so i guess the answer is no i cannot
because i i don't know
extremely similar yeah maybe i went
completely [ __ ] insane and
imagining all that maybe that's what
happened
um so interestingly where are we gonna
store that
table where are we gonna store
so maybe it would be actually kind of
nice to um you know
uh to introduce some sort of um
uh some sort of a structure
uh let's call it font all right so it's
gonna be azil texture
texture right so this is the sprite
sheet
um might as well called actually sprite
sheet all right so this is the sprite
sheet
and then we're going to have the glyph
table
glyph table right so and how many glyphs
we want to have in here
center and receiver uh
sender and receiver so the the size of
the table is going to be
the amount of displayable characters
right
um man i wish this was like a pascal
where i could specify that the
boundaries of this array is
is something like this and then i
wouldn't have to worry about
upsetting everything and stuff like that
it would be so goddamn cool
but it's just like yeah it's c i can't
do this kind of stuff
so it is what it is uh can i at least do
something like 127-32
um so where is my
uh ascii yeah it's 127 minus 32 and
that's the essential grid table
we might as well actually do something
like ascii uh
display low um
right let's keep display 32 ask display
high
high is actually 126 so that means if we
want to do something like ascii display
low high minus ascii display low
right right
we'll have to add one in here and the
reason why i want to have
something like this is because when i'm
going to be looking up the glyphs and
[ __ ]
um um i will have to upset it by
by low essentially right so i can take a
um right so as you can see i'm setting
it by ascii
display low right and here's the index
and then i can use that index
in a glyph table right and just compute
everything but we need to initialize
this entire
thing
all of unicode um so
yeah for now this entity i think is not
going to support unicode but we only
started we like started developing this
thing one and a half of an hour ago so
don't have too high with expectation
before we can have it here
[Music]
do you specifically study english for
these streams or did it
while you started streaming i
worked in outsource for like
a couple of two to three years or so and
i needed english to
actually speak with customers
so it is what it is
so i think we need some sort of a
function um
that creates a font from uh
from a particular file right a font um
load from file uh and
we're gonna be actually doing something
like this we're gonna try the file path
all right i'm gonna have a font in here
so initially it's gonna be like zero
[Music]
so and font sprite sheet right from
sprite sheet i think
um it's going to use one of these like
load uh font load forms texture okay so
i need to
uh yeah surface yeah i will need to do
all this [ __ ]
right so uh font
load from file from file
so this is the phone surface we load in
the
um the surface from the file path
right so this is the file path and then
we're assigning the texture to the phone
sprite sheet
right so this is the sprite sheet that
we want to do in here what's funny is
that after that the surface is not
really needed anymore
uh and as far as i know we can just free
the surface
right still free surface
um i wonder if freeing the surface
also frees the underlying buffer
[Music]
it is actually very interesting so you
know what i have an idea
what if i go to the source code and just
check
all right so we do have a source code
thirst code
uh we can always just go and check this
kind of stuff so this is gonna be grep
uh sdl um free
surface right so where is it defined
i don't know where is it defined so here
oh
it's a macro look at that
so it's a macro to seo surface
reel okay that's very interesting
so what about the real one uh
yeah there's only there's only one real
one which is kind of weird but
uh maybe i missed something uh maybe i
missed some other things
so this is the dynamic proc um
[Music]
i didn't see any definitions i was
talking about
there's this thing dynamic proc maybe
that's what we're looking for but not
really
um
[Music]
maybe i'm looking in the wrong place so
let's actually look for it
somewhere here okay so there's more
things
oh yeah fine oh it's an includes but
this is only declaration
they're called spec
[Music]
all right whatever i'm not gonna even
bother to do that uh
that's totally fine uh sdl free
surface right so free surface font so
there we go so we loaded everything up
and we freed the surface
though uh free surface doesn't even
accept anything in here so
maybe it doesn't even do anything is
free surface even real
well it is real because it redirects to
a free surface thrill okay
but maybe they're trying to debate us
maybe they're trying to convince that
that it's real but in reality it is not
real
what if it's not real [ __ ] anyway
so uh let's actually pre-calculate
everything so we're going to be doing
something like for
uh size c uh ascii
asking display low uh
uh asking it's actually asking
display high
and this is where we're going to be
pre-computing all these things so i
think
i need to copy paste this stuff in here
because this is definitely
super pre-computable super
pre-computable
uh so ascii minus ascii display low
um all right and then
from that index where should be able did
they remove for row and
i'm going to straight up remove it so
it's kind of it's kind of done but yeah
size t so um column
all right column is essentially taking
the index
and doing mod font calls
right font calls and then we're going to
have a row
uh rows there we go so and
in here we're pre-computing the glyphs
all right so this one is going to be
font
glyph uh the leaf table
uh for the index in here there we go
that should be actually
[Music]
so and after that we're going to be
returning font
and we're returning photo font and
because of that we don't have to do this
kind of [ __ ] anymore
right so you can just use the index uh
and maybe even move it somewhere here so
you figure out the dst
so here's your dst but src
is effectively so this one has to be a
font i suppose
all right so let's point it to a font
uh render copy font sprite sheet
right so this is a font sprite sheet and
src is a
font glyph glyph
table index there we go
that's how we do that all right so
that's the whole thing actually
furthermore maybe
when you're rendering like a bunch of
text
right when you're rendering a bunch of
text you can set the color only once
uh and in here
okay that's actually very interesting
yeah so it's fine so
i reduced the size of this function
quite you know quite well
um so it became simpler and because of
that maybe even became faster who knows
so in here we set the uh the mode of the
texture only once we iterate and we're
just looking up the
existing leaves and whatnot so that's
actually pretty cool i really like that
so but we have to be super careful in
here right so
the assert um
maybe we can assert that
c is a greater or recall than ascii
display low and it's less
or equal than ascii display high
uh right and that should be it otherwise
it's just like
um it's gonna fail
so here we have font and here we're also
gonna be having a
font all right
okay so that's basically the thing i
want you to do and we need to go to the
compilation errors
let's go through the compilation
all right so yeah so this is the
renderer
oh i need to actually specify the
renderer just to be able to load the
font
renderer
[Music]
so and here okay so i have to do
something like sdl
correct
all right so uh caller is an used
parameter
oh this is because you don't have to
specify it in here yeah so you need to
specify them here anything else
[Music]
so sprite sheet
so we're using sprite sheet
and render character we don't have to
specify the core
so we're almost there compiler assisted
refactoring
so and in here we don't even need to do
that so we need to load just the font
all right load font
uh it was called font load i think it
was called font load from file
uh and this is gonna be a renderer and
we're just extracting this thing
from here and that should be
enough
[Music]
send us a complete zipped code blocks
installation with allegra 4 installed
because no one could install it on
windows
nice one uh
okay so this is a font texture and here
i just covered the font i think i have
to actually pass it by a pointer
uh yep and i think i managed to do that
so it seems to be working and we're
actually cashing the glyphs
and let's see if i didn't [ __ ] it up i
[ __ ] it up
nice i wonder how how did that [ __ ] it
up i have no idea
i wonder how i [ __ ] it up mate how did
they [ __ ] it up
so in here uh i'm just situating through
all of this ascii stuff
index uh oh yeah i see well
that was easy um um yeah
okay okay um
that was freaking easy uh
easy easy fix easy life um all right
so now we're actually cashing the glyphs
and so that means that
this kind of shed has to be super fast
it must be super fast let's actually use
like
a white color right the classical white
color
uh and so yeah we have a hello world we
can also make it
like a little bit a little bigger right
so let's just make it a little bit
bigger
uh so now we can try to handle the
keys and maybe append something into the
buffer if you know what i'm talking
about
uh that would be rather interesting
right so let me see let me see
so where are we going to be storing the
buffer all right so for now let's
allocate it like globally
so this is going to be a buffer capacity
uh buffer capacity and
um so yeah you won't be able to edit
files
bigger than one kilobyte i'm really
sorry so if you want to be able to edit
files more than one kilobyte you will
have to pay me
so so that's
that's the law that's the law uh
all right so what we're going to be
doing in here so do i need to do
something like
i might as well actually keep the size
of the buffer right so it could be
something like buffer size and
it's going to be something like this um
so
yeah we definitely need a render like
text
size if you know what i'm talking about
because sometimes i want to render new
terminator strings sometimes i want to
render a size text
and i want to have a both of the
versions so let's actually render text
uh sized right it literally has like the
same
signature right almost the same texture
but on top of that it also accepts a
text size
text size and i think i'm going to just
take the implementation in here and
just put it here like
uh this in here i don't have to compute
n i can just use
text size and the render text
can be re-implemented in terms of uh
text size
right so something like this something
like this
so we're going to provide the renderer
and then we're going to provide the font
uh then the text and since we know that
it's not terminated we can do ester
len text
there we go moz mods
get ready
mods
all right so render attacks
cute modes cute mods um
all right so and i want to do the size
thing in here so here we're gonna have a
buffer
uh and then buffer size there we go
uh okay and it doesn't compile um buffer
said
don't i have a buffer size excuse me
here it is here's the buffer size what
the [ __ ]
incompatible type is that because uh
yeah i forgot to put sides in here
[Music]
all right seems to work so we need to
handle the
text input right as far as i know
as far as you know sdl has a text input
events
text input um so we can utilize that
i think you have to enable them first
right
[Music]
so yeah type text input all right so
we can try to do something like this
case still
text input right so here's the text
input and we're gonna
break it in here and maybe we can print
something in here
so that's the altx input so every time
you get something like this it's gonna
be sdl text simple
and uh a boom
uh before it works so and in here
we literally have the text okay so
that's cool um
so we just need to take event
uh text i suppose i don't even remember
is it just
input or is it uh sdl event show me the
definition of sdl event quiz
text input okay so it's literally text
text okay so i just need to append text
into the buffer
right so what that's what i need to do
uh so does it even have this size or is
it non-terminated uh it's a
non-terminated thing okay
so that's that's cool um so that means i
can do something like
uh const size t text size right so it's
gonna be strlen
all right so this is how much we need to
append in there
uh and uh we need to check
if
[Music]
so if we have enough space to do that so
how much space do we even have so buffer
capacity
minus buffer size so this is how much
space we have
if the text size right if the text size
is greater than free space right so this
is basically free
uh space like this cost
and if the text size is greater than
free space
we make the text size uh equal
to the free space we're not allowing to
actually append more than
the immediate and after that we can do
uh mem cpy
buffer so this is the destination
destinations buffer size
and the source is event text
text and how much you want to copy you
want to copy text size
and after that uh we say buffer size
plus equal text size
so essentially we're just you know we
type in and we're appending [ __ ] into
the buffer
so that's precisely what we do nothing
particularly special nothing
particularly special okay
so this doesn't even compile properly um
so because this one is cost it doesn't
have to be cost sure
sure
two hours and we already can type [ __ ]
isn't that amazing i think it's good and
[ __ ] amazing
uh all right
so this is just the text uh
input event do we have anything else uh
how do we handle like
backspaces or something like that maybe
we could we could try to handle the
backspaces
so case sdl uh key
down right so we have a cases l key down
and then we can switch on the kind of
key that was pressed event
key
key sim i think and then sim
and if sdl sdl key
backspace i think it's called backspace
right uh
we can simply if buffer size
is greater than zero we're just doing
buffer size
minus
is it gonna work now yo
you can already backspace this [ __ ]
um
when did they add this syntax it was
always there
it's an empty block
right so essentially you can create like
this nested block like that
with its own code and nothing is going
to be visible outside of that block
but who said that this block cannot be
empty
this syntax was always there i mean it's
just an empty scroll block
come on uh all right
so maybe we also need to keep track of
the cursor right
so this is the buffer size and uh let's
introduce something like a buffer cursor
uh buffer cursor
so initially it's going to be a zero uh
but on top of that we need to be able to
render this entire thing
i'm tired just
i've been working on this thing non-stop
for two hours and we got something but
i'm
super super tired
super super tired maybe i need some tea
does anyone have any tea super tight
i drank mine coffee
yeah coffee would be nice but i get
really addicted to cafe really quickly
so i just try to not to do that
miss
you drinking cold tea right now called
brew or just
chilled cute tea
no tea drinking were the same by the way
it was just like
yeah uh do you have some chocolate you
deserve
no i do not deserve a treat i do not
deserve anything i'm a really bad person
see that situation for two hours okay
that's a very nice way to chew what i
suppose
um i have a headache if i don't drink at
least two coffee
yeah it is part of the caffeine
withdrawal
actually so headaches are
syndrome soft caffeine withdrawal so i
don't understand that
that's why it's so difficult to dig the
coffee because every time you try to do
that you get a massive headache and it's
just like holy [ __ ]
um so i do understand you right
and that's the reason why i cannot get
rid of the caffeine completely and still
drink tea
because like at least that uh helps with
my
headaches i just embraced a lot of
people just embrace the addiction and
i think cgp gray actually
made a video about that addiction right
so
we're here rational russia analyzed to
to have this addiction at all um so
yeah just increase
okay just drink coffee that's it yeah
but i mean
so kind of kind of
bad for your heart i suppose
addiction is a fun companion
[Music]
depends on the addiction nicotine
addiction is actually not fun
to be fine not fun at all
[Music]
we need to be able to render the
um
[Music]
i suppose the like background thing
[Music]
c c plus plus addiction i'm not addicted
to c slash c plus plus
that's for sure but the problem is that
i don't really have that much choice
when it comes to the level of control it
can happen here
uh yeah write all this code
my god like that's a lot of 200 lines of
code
200 lines of code i'm not addicted
that's what everyone says
cup yeah indeed
indeed indeed indeed indeed uh so
maybe we should treat our text editor
as like a grid cell or whatnot
so because you see we're like scaling
the text and [ __ ]
right so we're just scaling the text uh
but maybe we should think about it uh in
terms of like
cells right so um
so this is the font and maybe we're
gonna have some sort of like a font
scale
like a global font scale um so
and right now the phone scale
is around what i think it's fine
uh i think it's
fine so it's around it's around five
okay so this is gonna be
something fine
[Music]
i forgot how to type in russian layout
that's actually super easy
that's that's how you do that
see easy just type like this
[Music]
so because of that so this is the scale
and
fake rush
[Music]
render render cursor
right so we're gonna have a render
cursor we have to provide the renderer
and we probably have to provide the
position of that cursor i suppose
right the position of the cursor is
going to be
okay so it's gonna be something like
this
uh we're gonna take the cursor from the
global variable yes we're using global
variables okay
don't judge me i'm only learning how to
how to do programming okay
[Music]
so buffer cursor
buffer cursor all i need to do here i
need to multiply it by
font uh width
[Music]
on scale it's not the phone surface but
it's upon scale
right so and this is basically the
uh the x right so we need to do
something like sdl
erect um
so this is going to be the x and uh
we're going to be flooring this entire
thing so we're
literally floating it and then we
converted to int
all right so convert into it this is
going to be y in terms of
y i think a y is going to be literally
zero right so
there is no need to even this something
like this so
and a width and height is going to be um
basically font width scale and height
function thank you so much for 25 months
holy [ __ ]
of tier 1 subscription i do not deserve
this much of support but thank you thank
you so much
uh i really appreciate it um okay so
and after that we can try to render this
entire thing
right so um it's going to be
sdl um two
and grep rn so sdl
uh what is it scent set
uh color right so let's set the color
uh render draw set render draw color
okay so there we go
and yep
and we need to check the code so here by
the way
i want to use my magical
macro right you see how in sdl rendered
or caller you have to
pass each individual component separate
the cyber dying yeah
thank you so much for gifted subs uh
thank you um i do not deserve this much
stuff so i'm a really bad person
so thank you so much so look look
look look look um i really appreciate
all the support um thank you
so you see you have several companies in
here but we pass the core around
as this code right so it passes around
as this code so i like to define a
pretty cool macro
that accepts the the code and expands it
into
this sort of components right so
essentially
i want to call it something like unhex
right so this is going to be on hex you
accept the color
and uh essentially the first one has to
be
red red is the first thing so we take
the color
uh and we shift it by zero bytes
right we shift it by zero byte and we
extract uh
0xf in here right and essentially
uh the thing we're doing in here one two
three four
uh we are repeating this thing like four
times
four times and then one two and three
so and then you can quite easily just
say uh
on hex zero x f f f
f f right so uh one two
three yeah there we go so and this thing
will automatically just expand and
you know work for you this is actually
something that i
like to do people who watch me regularly
they know about this trick because i use
it all the time
it's just like for new people if if
anyone is interested
right so we have a function that accepts
several arguments uh you can just make a
macro that expands into this
argument so it's kind of similar to c
plus plus unpacking or something
if you think about it
all right so um
so because of that we can just use
something like you insert it to color
and then i can actually do something
like that
there we go and in reality set render
draw color actually accepts
five arguments right but because of this
macro we managed to compress it into two
arguments
um i'm not sure how readable it is but i
mean it's quite convenient actually um
okay so here is direct unused variable
okay so that's
fine uh we just need to use it um
surrender feel erect
chat chat chat i have a question for you
chad
do you feel a wreck oh i'm sorry
classic am i right classic
okay
so here's the render and we'll probably
have to provide something like this in
here
um
nice one the [ __ ]
i think i did a [ __ ] wacky chat uh oh
because yeah
so i used the width of the whole sprite
sheet
uh what i should have used instead is
the character
white wrecked big big boy cursor uh
yeah now we're talking uh so interesting
enough uh as we append
[ __ ] uh i think maybe we should actually
yeah let's actually synchronize buffer
size and buffer cursor right cursor
equal to buffer size and we'll see how
it goes
uh the [ __ ] was that okay so that was
bad
um so it actually flew off look look
look the the cursor actually literally
flew off
it's just like yeah
okay i wonder what exactly happened oh
yeah it's it's the same [ __ ] all over
again
yeah so i forgot to put a character in
here of course
of course um
all right so font is just a scale
uh too much acceleration yeah
oh and when you do back backspace it
doesn't actually uh
you know perform everything
appropriately so we need to synchronize
the cursor uh
every time right so it's gonna be
buffer size here's the buffer size
a buffer size there we go and then we
can
yeah look at that look at that and it
actually doesn't rub [ __ ] around but
yeah you cannot move this cursor around
but yeah
it's like a typewriter yeah yeah boy
and then i can go here that's actually
pretty cool
it's pretty cool it's pretty cool
um so maybe you know what i actually
wanna
like i wanna be able to control the
the zoom because that's something that i
do all the time
with emacs right i wanna be able to do
this kind of [ __ ]
this is this is cursor by the way it
actually keep
expanding so this is how big it is and
then i can go back so i want to be able
to do this kind of stuff
uh did you see that series of books
about c plus plus and ray tracing
uh are you trying to advertise your
stuff
on my channel disgusting okay um
let me see
[Music]
um so maybe we can actually
pass some stuff in there so it's going
to be something like sdok
uh plus is it like flash but i don't
quite remember
so let's just do grep where is sdl key
uh they're all located in the in the
codes right so sdl
yeah [ __ ] [ __ ] uh
so uh
and this is gonna be plus right so is it
called plus
there we go so this is just sdlk plus
[Music]
sure sure
not advertising by the way sure
cup smh my age
uh so and i need to check if the uh
if any modifiers are actually pressed
like control or something
you know what i'm talking about uh so
let me try to run this entire thing
is it running okay so i can do plus but
if i do
control plus it's still okay so this one
is rather
yeah this is the problem i think um
because
it will type it instead but
let's not do that um
so you know what i want to do i want to
have a special function that sort of
um accepts the thing that you want to
insert into the buffer
we need to have a buffer as the
as the structure as an entity if you
know what i'm talking about right so it
has to be
like an entity it will have the size
and the cursor and all of the stuff that
needs to be
done right uh all the stuff that needs
to be done
uh but unfortunately i'm super super
tired right now so let's actually
you know what let's do a committee
committee and maybe even push a pushing
uh so what do we have in here i'm gonna
do git ignore
uh te and uh
right so this is going to be something
like read me
text editor and i'm just going to do a
quick start
and it's going to be console
make that doesn't have to be minus b to
the fire that doesn't have to
be right and the
license is mit there we go we're going
to be releasing that on the mit license
getting it and then we're going to be
doing a ready
set a go
ready set a go and
let's create a separate repo where we're
going to be pushing all of that
we're going to be sending
[Music]
so this is going to make um
[Music]
origin url uh
pushed the origin all right
and i'm gonna push it right into the
reaper
okay so is it is it there so the source
code is available here
go grab it and check it for yourself so
right now we have a text editor
that is capable of doing what let's
let's rebuild it
[Music]
this capable of doing that and you can
also backspace but you cannot control
[ __ ] but i mean it's just like yeah
that's what we managed to implement in
two hours uh but unfortunately
boys and girls uh it is time for me to
go
uh thanks everyone who's watching me now
i really appreciate it
have a good one and i see you all i
don't know when i don't know where
um yeah that's it for the day
hope it was fun thank you so much for
watching i really appreciate all the
support even though i don't deserve it
thank you everyone love you all
[Music]
you