How do you do a directx wrapper?

General FreeBASIC programming questions.
lassar
Posts: 263
Joined: Jan 17, 2006 1:35
Contact:

How do you do a directx wrapper?

Postby lassar » Jul 12, 2018 0:35

I have been trying to figure out how to improve my 640 by 480 program.

Think the fonts would look better in the 1280 by 960 32 bit resolution.

To avoid a lot of work, I think a directx wrapper with hq2x scaler would be the easiest way.

Does anyone know of a directx wrapper that already does this.

If not, how do I do this directx wrapper?
dodicat
Posts: 4951
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: How do you do a directx wrapper?

Postby dodicat » Jul 12, 2018 16:56

you wrote:
To avoid a lot of work, I think a directx wrapper with hq2x scaler would be the easiest way.

Er.. well!
If you have windows and use the 32 bit compiler then an easy scale up would be perhaps:

Code: Select all


Screen 18,,,&h08   ''640,480
Dim Shared As Integer xres,yres
Screeninfo xres,yres
Dim As Integer I
Screencontrol(2,I)'getwindowhandle
Dim As Any Ptr Win = Cast(Any Ptr,I)
Declare Function MoveWindow Alias "MoveWindow"(As Any Ptr,As Integer,As Integer,As Integer,As Integer,As Integer) As Integer
           
 MoveWindow(Win,20,20,1280,960,1)
 ' from   640,480  to  1280,960
 
 Sub MoveScreen(mx As Long=0,my As Long=0,mb As Long=0)
        Getmouse mx,my,,mb
        Static As Long lastmx,lastmy,lastx,lasty
        If lastx=mx Andalso lasty=my Then Exit Sub Else lastx=Mx:lasty=my
        Dim As Integer x,y: Screencontrol 0, x, y
        If mb=1 Then Screencontrol 100, x-(lastmx-mx),y-(lastmy-my):Exit Sub
        lastmx=mx:lastmy=my
    End Sub
   
    Sub chars(mx as long=0,my as long=0,btn as long=0)
    Dim As Integer w=Width
    #define rr(f,l) (Rnd*(l-f)+f)
    Dim As Integer h,v,n
    Do
        getmouse mx,my,,btn
        MoveScreen(mx,my,btn)
        v=rr(0,Hiword(w)):h=rr(0,Loword(w)-1)
        Locate v,h
        Color rr(0,7),rr(0,7)
        If Csrlin<Hiword(w) Then
          GetAnAscii:n=rr(1,255):if n>6 and n<11 then goto GetAnAscii
        print chr(n)
        sleep 1
        End If
    Loop Until Len(Inkey)
End Sub

    chars
    color 15,0
    cls
    locate 6,6
    print "done"
   
 sleep 

directx would be a fascinating project, but It doesn't seem to work (using the examples).
I have only had fleeting tries at it over the years.
I hope somebody has an attempt here.

Return to “General”

Who is online

Users browsing this forum: No registered users and 5 guests