You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Color,EventType,Rect,WindowBuilder}from"jsr:@divy/sdl2";constwindow=newWindowBuilder("Hello World",1000,500,).build();constcanvas=window.canvas();constfont=canvas.loadFont('./fonts/Roboto-Regular.ttf',16);constwhiteForegroundColor=newColor(255,255,255,255);constfontTexture=font.renderBlended('Hello World',whiteForegroundColor);constcreator=canvas.textureCreator();consttextTexture=creator.createTextureFromSurface(fontTexture);const{w, h}=textTexture.query();constdestRect=newRect(20,20,w,h);constframe=()=>{canvas.setDrawColor(255,255,255,255);// Set background to whitecanvas.clear();canvas.copy(textTexture,undefined,destRect);canvas.present();}forawait(consteventofwindow.events()){switch(event.type){caseEventType.Draw:
frame();break;caseEventType.Quit:
Deno.exit(0);break;default:
break;}}
Given this minimal example ^ I get this as a result..
Where the text is super faint and I cant seem to figure out how to fix it. All the other 'game' showcase repos* don't use font and a couple of them have it commented out in the code. So I'm not sure if I'm really in the right direction or just trying to use a feature that's not really supported yet?
I believe there is some pointer issue or something happening. If you run it a few times you will note that the colors change / appear to be random.
Haven't looked into it but I think the renderBlended doesn't seem to observe the passed color and internally the color is read from another place in memory.
Given this minimal example ^ I get this as a result..
Where the text is super faint and I cant seem to figure out how to fix it. All the other 'game' showcase repos* don't use font and a couple of them have it commented out in the code. So I'm not sure if I'm really in the right direction or just trying to use a feature that's not really supported yet?
Running on Apple M2 FWIW
*https://github.com/dhairy-online/dino-deno
*https://github.com/dhairy-online/flappybird
*https://github.com/load1n9/caviar
The text was updated successfully, but these errors were encountered: