Coolbasic kaikilla "herkuilla"

Oletko tehnyt jotain, mistä muut voisivat hyötyä. Postita vinkit tänne.
Post Reply
User avatar
mkn
Member
Posts: 61
Joined: Wed Feb 17, 2010 4:12 pm

Coolbasic kaikilla "herkuilla"

Post by mkn » Mon Mar 01, 2010 8:47 am

Coolbasic jossa on asennettuna valmiiksi cbFUN,coolbasic sdk, Janin tekemä nettiselain ja cbnetwork(Lisäsin Valtzun cbnetwork ohjeen manuaaliin)
Eli coolbasic kaikilla herkuilla :D
Kopioi zipissä oleva kansio C:/program files/
Korvaa vanha coolbasicin kansio tällä tiedostolla niin olet valmis :D
Kommentoikaa!
Tiedosto ei mahtunut coolbasicin foorumeille joten lisäsin live skydriveen.
Lataa täältä: http://cid-8533b2a4fdd5bfed.skydrive.li ... lBasic.zip
"I'd love to change the world, but they won't give me the source code." - Anonymous

User avatar
Awaclus
Forum Veteran
Posts: 2938
Joined: Tue Aug 28, 2007 2:50 pm
Location: Sulkava

Re: Coolbasic kaikilla "herkuilla"

Post by Awaclus » Mon Mar 01, 2010 12:35 pm

Mutta tuosta puuttuu (ilmeisesti) modattu CB, jossa funktiorajaa on nostettu?
Every day I'm reshuffling.
[22:19] <@Grandi> Ha! Tiesin koko ajan, että Awaclus_ oli Awaclus. Hieno peitenimimerkki, mutta Grandia et huiputtanut.

User avatar
legend
Advanced Member
Posts: 371
Joined: Wed Nov 18, 2009 9:06 pm

Re: Coolbasic kaikilla "herkuilla"

Post by legend » Mon Mar 01, 2010 4:47 pm

Ihan hyvä, ei enään tarvitse hakea joka paikasta eri "herkkuja".
EDIT:

Siihen voisi lisätä OpenGL:n, sen Joystick jutun ja johonkin kohtaan multiscreen jutun.


User avatar
Jani
Devoted Member
Posts: 741
Joined: Fri Oct 31, 2008 5:53 pm

Re: Coolbasic kaikilla "herkuilla"

Post by Jani » Tue Mar 02, 2010 7:29 am

Päivitin vähän tuota ja lisäsin hyviä koodeja/kirjastoja.
Selasin foorumit läpi, mutta joitakin taisi unohtua ja muutamaa ei ollut enää netissä.
http://jani9.tk/Muuta/Lataukset/CBHerkut/CoolBasic.rar
Tai selaa kansioita osoitteessa http://jani9.tk/Muuta/Lataukset/CBHerkut/CoolBasic/
Dead men tell no tales. Also, Python rocks!
Codegolf: 99 bottles of beer (oneliner) - Water map partition

User avatar
phons
Guru
Posts: 1056
Joined: Wed May 14, 2008 10:11 am

Re: Coolbasic kaikilla "herkuilla"

Post by phons » Tue Mar 02, 2010 4:59 pm

Must jutut mitkä puuttuu olisivat: cbGL, cbSDL ja joku fysiikkakirjasto esim tämä: viewtopic.php?f=11&t=1869
Image

User avatar
Jani
Devoted Member
Posts: 741
Joined: Fri Oct 31, 2008 5:53 pm

Re: Coolbasic kaikilla "herkuilla"

Post by Jani » Tue Mar 02, 2010 7:23 pm

phons wrote:Must jutut mitkä puuttuu olisivat: cbGL, cbSDL ja joku fysiikkakirjasto esim tämä: viewtopic.php?f=11&t=1869
Paketti on nyt päivitetty. Kertokaas jos tosta puuttuu jtn. olennaista. Lisäilen tuohon, aina kun huomaan.
Dead men tell no tales. Also, Python rocks!
Codegolf: 99 bottles of beer (oneliner) - Water map partition

User avatar
MaGetzUb
Guru
Posts: 1715
Joined: Sun Sep 09, 2007 12:35 pm
Location: Alavus

Re: Coolbasic kaikilla "herkuilla"

Post by MaGetzUb » Wed Mar 03, 2010 11:57 am

En lähtisi lisäämään vielä Dream Physics Libarya, kun en ole saanut vielä kaikkia tärkeitä ominaisuuksia sinne rakennettua, sitäpaisti jotkun komentojen nimet on aika typeriä.
Solar Eclipse
Meneillä olevat Projektit:
We're in a simulation, and God is trying to debug us.

User avatar
Herra Siili
Advanced Member
Posts: 308
Joined: Tue Nov 25, 2008 9:06 pm
Location: Viitasaari, Keski-Suomi
Contact:

Re: Coolbasic kaikilla "herkuilla"

Post by Herra Siili » Sat Mar 13, 2010 10:24 am

Voisiko joku uppia tuon Janin paketin uudestaan, kun tuo http://jani9.tk/ näyttää olevan alhaalla?
a.k.a. Hedge

User avatar
Jani
Devoted Member
Posts: 741
Joined: Fri Oct 31, 2008 5:53 pm

Re: Coolbasic kaikilla "herkuilla"

Post by Jani » Sat Mar 13, 2010 1:22 pm

Herra Siili wrote:Voisiko joku uppia tuon Janin paketin uudestaan, kun tuo http://jani9.tk/ näyttää olevan alhaalla?
Juu, palvelin on tämän viikon alhaalla... Iltapäivällä toimisi.
Upin sen nyt kuitenkin. Edittaan kohta.

EDIT: Upittu ja löytyy osoitteesta http://up.servut.us/22103.34ycvrli
Dead men tell no tales. Also, Python rocks!
Codegolf: 99 bottles of beer (oneliner) - Water map partition

User avatar
Herra Siili
Advanced Member
Posts: 308
Joined: Tue Nov 25, 2008 9:06 pm
Location: Viitasaari, Keski-Suomi
Contact:

Re: Coolbasic kaikilla "herkuilla"

Post by Herra Siili » Sat Mar 13, 2010 2:44 pm

Kiitos. Lataan tuon huomenna, kun pääsen takaisin omalle koneelle.
a.k.a. Hedge

User avatar
Jani
Devoted Member
Posts: 741
Joined: Fri Oct 31, 2008 5:53 pm

Re: Coolbasic kaikilla "herkuilla"

Post by Jani » Sat Feb 09, 2013 7:51 pm

Nyt toivoisin, että jollakin olisi tuo mun paketti tallella.
EDIT:

Oli liikaa aikaa, joten kokosin ko. paketin uusiksi.
Sisältää:

  • cbCalcLib
  • cbGL
  • cbllo
  • cbSDL
  • cbSDK
  • cbNetwork
  • Modattu funktioraja (2000)
http://janijohannes.kapsi.fi/cbherkku.rar
En jaksanut putsata ylimääräisiä pois, joten paketissa on turhaakin tavaraa.[/edit]
Dead men tell no tales. Also, Python rocks!
Codegolf: 99 bottles of beer (oneliner) - Water map partition

User avatar
CCE
Artist
Artist
Posts: 650
Joined: Mon Aug 27, 2007 9:53 pm

Re: Coolbasic kaikilla "herkuilla"

Post by CCE » Mon Feb 11, 2013 1:20 am

Jos joku sattuu vielä käyttelemään cbGL:ää niin kannattaa varmaan käyttää tätä korjattua versiota cbGL.cb -tiedostosta, sillä alkuperäinen versio sisälsi härskejä muistipalojen ylikirjoituksia. Niin, ja ei kannata tuplaklikata cbGL-ohjelman otsikkopalkkia, sillä tämä asettaa ruudun resoluution ikkunan resoluutioksi.

Code: Select all

// cbGL - OpenGL Graphics Library for CoolBasic
// by Tapio Vierros 2008
// Version 0.4.0

Const gDLLFile = "cbGL.dll"

Const glAccum = 1
Const glActiveTexture = 2
Const glAlphaFunc = 3
Const glAreTexturesResident = 4
Const glArrayElement = 5
Const glAttachShader = 6
Const glBegin = 7
Const glBeginQuery = 8
Const glBindAttribLocation = 9
Const glBindBuffer = 10
Const glBindTexture = 11
Const glBitmap = 12
Const glBlendColor = 13
Const glBlendEquation = 14
Const glBlendEquationSeparate = 15
Const glBlendFunc = 16
Const glBlendFuncSeparate = 17
Const glBufferData = 18
Const glBufferSubData = 19
Const glCallList = 20
Const glCallLists = 21
Const glClear = 22
Const glClearAccum = 23
Const glClearColor = 24
Const glClearDepth = 25
Const glClearIndex = 26
Const glClearStencil = 27
Const glClientActiveTexture = 28
Const glClipPlane = 29
Const glColor = 30
Const glColorMask = 31
Const glColorMaterial = 32
Const glColorPointer = 33
Const glColorSubTable = 34
Const glColorTable = 35
Const glColorTableParameter = 36
Const glCompileShader = 37
Const glCompressedTexImage1D = 38
Const glCompressedTexImage2D = 39
Const glCompressedTexImage3D = 40
Const glCompressedTexSubImage1D = 41
Const glCompressedTexSubImage2D = 42
Const glCompressedTexSubImage3D = 43
Const glConvolutionFilter1D = 44
Const glConvolutionFilter2D = 45
Const glConvolutionParameter = 46
Const glCopyColorSubTable = 47
Const glCopyColorTable = 48
Const glCopyConvolutionFilter1D = 49
Const glCopyConvolutionFilter2D = 50
Const glCopyPixels = 51
Const glCopyTexImage1D = 52
Const glCopyTexImage2D = 53
Const glCopyTexSubImage1D = 54
Const glCopyTexSubImage2D = 55
Const glCopyTexSubImage3D = 56
Const glCreateProgram = 57
Const glCreateShader = 58
Const glCullFace = 59
Const glDeleteBuffers = 60
Const glDeleteLists = 61
Const glDeleteProgram = 62
Const glDeleteQueries = 63
Const glDeleteShader = 64
Const glDeleteTextures = 65
Const glDepthFunc = 66
Const glDepthMask = 67
Const glDepthRange = 68
Const glDetachShader = 69
Const glDisable = 70
Const glDisableClientState = 71
Const glDisableVertexAttribArray = 72
Const glDrawArrays = 73
Const glDrawBuffer = 74
Const glDrawBuffers = 75
Const glDrawElements = 76
Const glDrawPixels = 77
Const glDrawRangeElements = 78
Const glEdgeFlag = 79
Const glEdgeFlagPointer = 80
Const glEnable = 81
Const glEnableClientState = 82
Const glEnableVertexAttribArray = 83
Const glEnd = 84
Const glEndList = 85
Const glEndQuery = 86
Const glEvalCoord = 87
Const glEvalMesh = 88
Const glEvalPoint = 89
Const glFeedbackBuffer = 90
Const glFinish = 91
Const glFlush = 92
Const glFog = 93
Const glFogCoord = 94
Const glFogCoordPointer = 95
Const glFrontFace = 96
Const glFrustum = 97
Const glGenBuffers = 98
Const glGenLists = 99
Const glGenQueries = 100
Const glGenTextures = 101
Const glHint = 102
Const glHistogram = 103
Const glIndex = 104
Const glIndexMask = 105
Const glIndexPointer = 106
Const glInitNames = 107
Const glInterleavedArrays = 108
Const glIsBuffer = 109
Const glIsEnabled = 110
Const glIsList = 111
Const glIsProgram = 112
Const glIsQuery = 113
Const glIsShader = 114
Const glIsTexture = 115
Const glLight = 116
Const glLightModel = 117
Const glLineStipple = 118
Const glLineWidth = 119
Const glLinkProgram = 120
Const glListBase = 121
Const glLoadIdentity = 122
Const glLoadMatrix = 123
Const glLoadName = 124
Const glLoadTransposeMatrix = 125
Const glLogicOp = 126
Const glMap1 = 127
Const glMap2 = 128
Const glMapBuffer = 129
Const glMapGrid = 130
Const glMaterial = 131
Const glMatrixMode = 132
Const glMinmax = 133
Const glMultiDrawArrays = 134
Const glMultiDrawElements = 135
Const glMultiTexCoord = 136
Const glMultMatrix = 137
Const glMultTransposeMatrix = 138
Const glNewList = 139
Const glNormal = 140
Const glNormalPointer = 141
Const glOrtho = 142
Const glPassThrough = 143
Const glPixelMap = 144
Const glPixelStore = 145
Const glPixelTransfer = 146
Const glPixelZoom = 147
Const glPointParameter = 148
Const glPointSize = 149
Const glPolygonMode = 150
Const glPolygonOffset = 151
Const glPolygonStipple = 152
Const glPopAttrib = 153
Const glPopClientAttrib = 154
Const glPopMatrix = 155
Const glPopName = 156
Const glPrioritizeTextures = 157
Const glPushAttrib = 158
Const glPushClientAttrib = 159
Const glPushMatrix = 160
Const glPushName = 161
Const glRasterPos = 162
Const glReadBuffer = 163
Const glReadPixels = 164
Const glRect = 165
Const glRenderMode = 166
Const glResetHistogram = 167
Const glResetMinmax = 168
Const glRotate = 169
Const glSampleCoverage = 170
Const glScale = 171
Const glScissor = 172
Const glSecondaryColor = 173
Const glSecondaryColorPointer = 174
Const glSelectBuffer = 175
Const glSeparableFilter2D = 176
Const glShadeModel = 177
Const glShaderSource = 178
Const glStencilFunc = 179
Const glStencilFuncSeparate = 180
Const glStencilMask = 181
Const glStencilMaskSeparate = 182
Const glStencilOp = 183
Const glStencilOpSeparate = 184
Const glTexCoord = 185
Const glTexCoordPointer = 186
Const glTexEnv = 187
Const glTexGen = 188
Const glTexImage1D = 189
Const glTexImage2D = 190
Const glTexImage3D = 191
Const glTexParameter = 192
Const glTexSubImage1D = 193
Const glTexSubImage2D = 194
Const glTexSubImage3D = 195
Const glTranslate = 196
Const gluBeginCurve = 197
Const gluBeginPolygon = 198
Const gluBeginSurface = 199
Const gluBeginTrim = 200
Const gluBuild1DMipmapLevels = 201
Const gluBuild1DMipmaps = 202
Const gluBuild2DMipmapLevels = 203
Const gluBuild2DMipmaps = 204
Const gluBuild3DMipmapLevels = 205
Const gluBuild3DMipmaps = 206
Const gluCheckExtension = 207
Const gluCylinder = 208
Const gluDeleteNurbsRenderer = 209
Const gluDeleteQuadric = 210
Const gluDeleteTess = 211
Const gluDisk = 212
Const gluEndCurve = 213
Const gluEndPolygon = 214
Const gluEndSurface = 215
Const gluEndTrim = 216
Const gluErrorString = 217
Const gluGetNurbsProperty = 218
Const gluGetString = 219
Const gluGetTessProperty = 220
Const gluLoadSamplingMatrices = 221
Const gluLookAt = 222
Const gluNewNurbsRenderer = 223
Const gluNewQuadric = 224
Const gluNewTess = 225
Const gluNextContour = 226
Const glUniform = 227
Const glUnmapBuffer = 228
Const gluNurbsCallback = 229
Const gluNurbsCallbackData = 230
Const gluNurbsCallbackDataEXT = 231
Const gluNurbsCurve = 232
Const gluNurbsProperty = 233
Const gluNurbsSurface = 234
Const gluOrtho2D = 235
Const gluPartialDisk = 236
Const gluPerspective = 237
Const gluPickMatrix = 238
Const gluProject = 239
Const gluPwlCurve = 240
Const gluQuadricCallback = 241
Const gluQuadricDrawStyle = 242
Const gluQuadricNormals = 243
Const gluQuadricOrientation = 244
Const gluQuadricTexture = 245
Const gluScaleImage = 246
Const glUseProgram = 247
Const gluSphere = 248
Const glValidateProgram = 249
Const glVertex = 250
Const glVertexAttrib = 251
Const glVertexAttribPointer = 252
Const glVertexPointer = 253
Const glViewport = 254
Const glWindowPos = 255




// --- GENERAL --- //

Function cbglInit(w,h,flags=0)
    SetWindow "CB Window"
    mem = MakeMEMBlock(12)
    PokeInt mem, 0, w
    PokeInt mem, 4, h
    PokeInt mem, 8, flags
	CallDLL gDLLFile, "cbglInit", mem
    DeleteMEMBlock mem
EndFunction

Function cbglCls()
    CallDLL gDLLFile, "cbglCls"
EndFunction

Function cbglFlip()
    CallDLL gDLLFile, "cbglFlip"
EndFunction

Function cbglSetWindow(windowtitle$)
    strlen = Len(windowtitle)
    mem = MakeMEMBlock(strlen+4)
    PokeInt mem, 0, strlen
    offset=4
    For i = 1 To strlen
        PokeByte mem, offset, Asc(Mid(windowtitle, i, 1))
        offset+1
    Next i
    CallDLL gDLLFile, "cbglSetWindow", mem
    DeleteMEMBlock mem
End Function

Function cbglTerminate()
    CallDLL gDLLFile, "cbglTerminate"
EndFunction


// --- GRAPHICS PRIMITIVES --- //

Function cbglColor(r,g,b,a=255)
    mem = MakeMEMBlock(16)	// tää oli 12
    PokeInt mem, 0, r
    PokeInt mem, 4, g
    PokeInt mem, 8, b
    PokeInt mem, 12,a
	CallDLL gDLLFile, "cbglColor", mem
    DeleteMEMBlock mem
End Function

Function cbglDot(x, y, col)
    mem = MakeMEMBlock(12)
    PokeInt mem, 0, x
    PokeInt mem, 4, y
    PokeInt   mem, 8, col
	CallDLL gDLLFile, "cbglDot", mem
    DeleteMEMBlock mem
End Function

Function cbglLine(x1, y1, x2, y2)
    mem = MakeMEMBlock(16)
    PokeInt mem, 0, x1
    PokeInt mem, 4, y1
    PokeInt mem, 8, x2
    PokeInt mem, 12,y2
	CallDLL gDLLFile, "cbglLine", mem
    DeleteMEMBlock mem
End Function

Function cbglBox(x1, y1, x2, y2, filled=0)
    mem = MakeMEMBlock(20)
    PokeInt mem, 0, x1
    PokeInt mem, 4, y1
    PokeInt mem, 8, x2
    PokeInt mem, 12,y2
    PokeInt mem, 16,filled
	CallDLL gDLLFile, "cbglBox", mem
    DeleteMEMBlock mem
End Function

Function cbglCircle(x, y, r, filled=0)
    mem = MakeMEMBlock(16)
    PokeInt mem, 0, x
    PokeInt mem, 4, y
    PokeInt mem, 8, r
    PokeInt mem, 12,filled
	CallDLL gDLLFile, "cbglCircle", mem
    DeleteMEMBlock mem
End Function

Function cbglEllipse(x, y, a, b, filled=0)
    mem = MakeMEMBlock(20)
    PokeInt mem, 0, x
    PokeInt mem, 4, y
    PokeInt mem, 8, a
    PokeInt mem, 12,b
    PokeInt   mem, 16,filled
	CallDLL gDLLFile, "cbglEllipse", mem
    DeleteMEMBlock mem
End Function



// --- IMAGES --- //

Function cbglLoadImage(filename$, filter=1)
    strlen = Len(filename)
    mem = MakeMEMBlock(strlen+8)
    If filter = 0 Then PokeInt mem, 0, 5 Else PokeInt mem, 0, filter
    PokeInt mem, 4, strlen
    offset=8
    For i = 1 To strlen
        PokeByte mem, offset, Asc(Mid(filename, i, 1))
        offset+1
    Next i
    CallDLL gDLLFile, "cbglLoadImage", mem
    ret = PeekInt(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function

Function cbglDrawImage(id, x, y, rot#=0, scale#=1, alpha=255)
    mem = MakeMEMBlock(24)
    PokeInt   mem, 0, id
    PokeInt mem, 4, x
    PokeInt mem, 8, y
    PokeFloat mem, 12,rot
    PokeFloat mem, 16,scale
    PokeInt mem, 20,alpha
    CallDLL gDLLFile, "cbglDrawImage", mem
    DeleteMEMBlock mem
End Function

Function cbglImageWidth(id)
    mem = MakeMEMBlock(4)
    PokeInt mem, 0, id
	CallDLL gDLLFile, "cbglImageWidth", mem
    ret = PeekInt(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function

Function cbglImageHeight(id)
    mem = MakeMEMBlock(4)
    PokeInt mem, 0, id
	CallDLL gDLLFile, "cbglImageHeight", mem
    ret = PeekInt(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function


// --- TEXT --- //

Function cbglText(x, y, txt$, fontImageId, scale#=1.0)
    strlen = Len(txt)
    mem = MakeMEMBlock(strlen+20)
    PokeInt mem, 0, x
    PokeInt mem, 4, y
    PokeInt mem, 8, fontImageId
    PokeFloat mem, 12, scale
    PokeInt mem, 16, strlen
    offset=20
    For i = 1 To strlen
        PokeByte mem, offset, Asc(Mid(txt, i, 1))
        offset+1
    Next i
    CallDLL gDLLFile, "cbglText", mem
    DeleteMEMBlock mem
End Function


// Tämä ei toimi
'Function cbglText2(x, y, txt$)
'    strlen = Len(txt)
'    mem = MakeMEMBlock(strlen+12)
'    PokeInt mem, 0, x
'    PokeInt mem, 4, y
'    PokeInt mem, 8, strlen
'    offset=12
'    For i = 1 To strlen
'        PokeByte mem, offset, Asc(Mid(txt, i, 1))
'        offset+1
'    Next i
'    CallDLL gDLLFile, "cbglText2", mem
'    DeleteMEMBlock mem
'End Function


// Anna tälle cbglLoadImagella ladattu fontti kuva
// Tätä ei tarvi ollenkaan
'Function cbglBuildFont(fontImageId)
'    mem = MakeMEMBlock(4)
'    PokeInt mem, 0, fontImageId
'    CallDLL gDLLFile, "cbglBuildFont", mem
'    DeleteMEMBlock mem
'End Function


// Tämä ei toimi
'Function cbglLoadFont(fontname$, fontheight, fontweight)
'    strlen = Len(fontname)
'    mem = MakeMEMBlock(strlen+12)
'    PokeInt mem, 0, fontheight
'    PokeInt mem, 4, fontweight
'    PokeInt mem, 8, strlen
'    offset=12
'    For i = 1 To strlen
'        PokeByte mem, offset, Asc(Mid(fontname, i, 1))
'        offset+1
'    Next i
'    CallDLL gDLLFile, "cbglLoadFont", mem
'    DeleteMEMBlock mem
'End Function


// --- INPUT --- //

Function cbglKeyDown(scancode)
    mem = MakeMEMBlock(4)
    PokeInt mem, 0, scancode
    CallDLL gDLLFile, "cbglKeyDown", mem
    ret = PeekByte(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function


Function cbglMouseDown(button=1)
    mem = MakeMEMBlock(1)
    PokeByte mem, 0, button
    CallDLL gDLLFile, "cbglMouseDown", mem
    ret = PeekByte(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function

Function cbglMouseX()
    mem = MakeMEMBlock(4)
    CallDLL gDLLFile, "cbglMouseX", mem
    ret = PeekInt(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function

Function cbglMouseY()
    mem = MakeMEMBlock(4)
    CallDLL gDLLFile, "cbglMouseY", mem
    ret = PeekInt(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function

Function cbglMouseZ()
    mem = MakeMEMBlock(4)
    CallDLL gDLLFile, "cbglMouseZ", mem
    ret = PeekInt(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function


// --- OPENGL WRAPPING FUNCS --- //

Function cbgl0(cmdname)
    mem = MakeMEMBlock(1)
    PokeByte mem, 0, cmdname
    CallDLL gDLLFile, "cbgl0", mem
    DeleteMEMBlock mem
End Function


Function cbgl1i(cmdname, param1)
    mem = makeMEMBlock(5)
	pokeInt mem, 0, param1
    PokeByte mem, 4, cmdname
    CallDLL gDLLFile, "cbgl1i", mem
    DeleteMEMBlock mem
End Function

Function cbgl2i(cmdname, param1, param2)
    mem = MakeMEMBlock(9)
    PokeInt mem, 0, param1
    PokeInt mem, 4, param2
	PokeByte mem, 8, cmdname
    CallDLL gDLLFile, "cbgl2i", mem
    DeleteMEMBlock mem
End Function

Function cbgl3i(cmdname, param1, param2, param3)
    mem = MakeMEMBlock(13)
    PokeInt mem, 0, param1
    PokeInt mem, 4, param2
	PokeInt mem, 8, param3
	PokeByte mem, 12, cmdname
    CallDLL gDLLFile, "cbgl3i", mem
    DeleteMEMBlock mem
End Function

Function cbgl4i(cmdname, param1, param2, param3, param4)
    mem = MakeMEMBlock(17)
    PokeInt mem, 0, param1
    PokeInt mem, 4, param2
	PokeInt mem, 8, param3
    PokeInt mem, 12, param4
	PokeByte mem, 16, cmdname
    CallDLL gDLLFile, "cbgl4i", mem
    DeleteMEMBlock mem
End Function


Function cbgl1f(cmdname, param1#)
    mem = MakeMEMBlock(5)
	PokeFloat mem, 0, param1
    PokeByte mem, 4, cmdname
    CallDLL gDLLFile, "cbgl1f", mem
    DeleteMEMBlock mem
End Function


Function cbgl2f(cmdname, param1#, param2#)
    mem = MakeMEMBlock(9)
    PokeFloat mem, 0, param1
    PokeFloat mem, 4, param2
	PokeByte mem, 8, cmdname
    CallDLL gDLLFile, "cbgl2f", mem
    DeleteMEMBlock mem
End Function

Function cbgl3f(cmdname, param1#, param2#, param3#)
    mem = MakeMEMBlock(13)
    PokeFloat mem, 0, param1
    PokeFloat mem, 4, param2
	PokeFloat mem, 8, param3
	PokeByte mem, 12, cmdname
    CallDLL gDLLFile, "cbgl3f", mem
    DeleteMEMBlock mem
End Function

Function cbgl4f(cmdname, param1#, param2#, param3#, param4#)
    mem = MakeMEMBlock(17)
    PokeFloat mem, 0, param1
    PokeFloat mem, 4, param2
	PokeFloat mem, 8, param3
    PokeFloat mem, 12, param4
	PokeByte mem, 16, cmdname
    CallDLL gDLLFile, "cbgl4f", mem
    DeleteMEMBlock mem
End Function

Kiitokset joxulle bugien löytämisestä.

User avatar
atomimalli
Moderator
Moderator
Posts: 226
Joined: Wed Aug 29, 2007 3:55 pm

Re: Coolbasic kaikilla "herkuilla"

Post by atomimalli » Sun Jun 22, 2014 3:01 pm

Harmittaa, että olen hukannut cbGL-testit. Jätin pelin tekemättä kun se kaatuili odottamattomasti. Kännykän muistikortti, jolla oli kopio, lahosi niin että tiedostoja katosi :(

Minulle tärkein lisä coolbasiciin on cbpp, jonka ympärille voisi rakentaa tälläisen uuden herkkupaketin. Siitä on ollut hyötyä melkein kaikessa, mitä olen tehnyt sen valmistumisesta asti.

Nykyään relevanttia olisi myös cbE, mutta sitä ei ole tullut käyttettyä cbpp:n kanssa vielä. Kenties paras olisi että voisi pragmalla valita kääntäjän tai jotain :o

User avatar
MaGetzUb
Guru
Posts: 1715
Joined: Sun Sep 09, 2007 12:35 pm
Location: Alavus

Re: Coolbasic kaikilla "herkuilla"

Post by MaGetzUb » Sun Jun 22, 2014 8:18 pm

Nyt kun tuli bump tälle topikille niin sanoisin että cbGL:n tulisi käyttää kokoajan yhtä muistipala kun dataa siirretään dll:e edestakaisin.
CCE wrote:Jos joku sattuu vielä käyttelemään cbGL:ää niin kannattaa varmaan käyttää tätä korjattua versiota cbGL.cb -tiedostosta, sillä alkuperäinen versio sisälsi härskejä muistipalojen ylikirjoituksia. Niin, ja ei kannata tuplaklikata cbGL-ohjelman otsikkopalkkia, sillä tämä asettaa ruudun resoluution ikkunan resoluutioksi.

Code: Select all

..cbGL include headeri..
Kiitokset joxulle bugien löytämisestä.
Päivittelin tuota vanhaa headeria pikkuisen. :)

Code: Select all

// cbGL - OpenGL Graphics Library for CoolBasic
// by Tapio Vierros 2008
// Version 0.4.1

//Updated by MaGetzUb
//Changes: 
// - added: a global memblock which optimizes the data
//   transfer between cb and DLL file.

Const gDLLFile = "cbGL.dll"
Global gDLLMemory 

Const glAccum = 1
Const glActiveTexture = 2
Const glAlphaFunc = 3
Const glAreTexturesResident = 4
Const glArrayElement = 5
Const glAttachShader = 6
Const glBegin = 7
Const glBeginQuery = 8
Const glBindAttribLocation = 9
Const glBindBuffer = 10
Const glBindTexture = 11
Const glBitmap = 12
Const glBlendColor = 13
Const glBlendEquation = 14
Const glBlendEquationSeparate = 15
Const glBlendFunc = 16
Const glBlendFuncSeparate = 17
Const glBufferData = 18
Const glBufferSubData = 19
Const glCallList = 20
Const glCallLists = 21
Const glClear = 22
Const glClearAccum = 23
Const glClearColor = 24
Const glClearDepth = 25
Const glClearIndex = 26
Const glClearStencil = 27
Const glClientActiveTexture = 28
Const glClipPlane = 29
Const glColor = 30
Const glColorMask = 31
Const glColorMaterial = 32
Const glColorPointer = 33
Const glColorSubTable = 34
Const glColorTable = 35
Const glColorTableParameter = 36
Const glCompileShader = 37
Const glCompressedTexImage1D = 38
Const glCompressedTexImage2D = 39
Const glCompressedTexImage3D = 40
Const glCompressedTexSubImage1D = 41
Const glCompressedTexSubImage2D = 42
Const glCompressedTexSubImage3D = 43
Const glConvolutionFilter1D = 44
Const glConvolutionFilter2D = 45
Const glConvolutionParameter = 46
Const glCopyColorSubTable = 47
Const glCopyColorTable = 48
Const glCopyConvolutionFilter1D = 49
Const glCopyConvolutionFilter2D = 50
Const glCopyPixels = 51
Const glCopyTexImage1D = 52
Const glCopyTexImage2D = 53
Const glCopyTexSubImage1D = 54
Const glCopyTexSubImage2D = 55
Const glCopyTexSubImage3D = 56
Const glCreateProgram = 57
Const glCreateShader = 58
Const glCullFace = 59
Const glDeleteBuffers = 60
Const glDeleteLists = 61
Const glDeleteProgram = 62
Const glDeleteQueries = 63
Const glDeleteShader = 64
Const glDeleteTextures = 65
Const glDepthFunc = 66
Const glDepthMask = 67
Const glDepthRange = 68
Const glDetachShader = 69
Const glDisable = 70
Const glDisableClientState = 71
Const glDisableVertexAttribArray = 72
Const glDrawArrays = 73
Const glDrawBuffer = 74
Const glDrawBuffers = 75
Const glDrawElements = 76
Const glDrawPixels = 77
Const glDrawRangeElements = 78
Const glEdgeFlag = 79
Const glEdgeFlagPointer = 80
Const glEnable = 81
Const glEnableClientState = 82
Const glEnableVertexAttribArray = 83
Const glEnd = 84
Const glEndList = 85
Const glEndQuery = 86
Const glEvalCoord = 87
Const glEvalMesh = 88
Const glEvalPoint = 89
Const glFeedbackBuffer = 90
Const glFinish = 91
Const glFlush = 92
Const glFog = 93
Const glFogCoord = 94
Const glFogCoordPointer = 95
Const glFrontFace = 96
Const glFrustum = 97
Const glGenBuffers = 98
Const glGenLists = 99
Const glGenQueries = 100
Const glGenTextures = 101
Const glHint = 102
Const glHistogram = 103
Const glIndex = 104
Const glIndexMask = 105
Const glIndexPointer = 106
Const glInitNames = 107
Const glInterleavedArrays = 108
Const glIsBuffer = 109
Const glIsEnabled = 110
Const glIsList = 111
Const glIsProgram = 112
Const glIsQuery = 113
Const glIsShader = 114
Const glIsTexture = 115
Const glLight = 116
Const glLightModel = 117
Const glLineStipple = 118
Const glLineWidth = 119
Const glLinkProgram = 120
Const glListBase = 121
Const glLoadIdentity = 122
Const glLoadMatrix = 123
Const glLoadName = 124
Const glLoadTransposeMatrix = 125
Const glLogicOp = 126
Const glMap1 = 127
Const glMap2 = 128
Const glMapBuffer = 129
Const glMapGrid = 130
Const glMaterial = 131
Const glMatrixMode = 132
Const glMinmax = 133
Const glMultiDrawArrays = 134
Const glMultiDrawElements = 135
Const glMultiTexCoord = 136
Const glMultMatrix = 137
Const glMultTransposeMatrix = 138
Const glNewList = 139
Const glNormal = 140
Const glNormalPointer = 141
Const glOrtho = 142
Const glPassThrough = 143
Const glPixelMap = 144
Const glPixelStore = 145
Const glPixelTransfer = 146
Const glPixelZoom = 147
Const glPointParameter = 148
Const glPointSize = 149
Const glPolygonMode = 150
Const glPolygonOffset = 151
Const glPolygonStipple = 152
Const glPopAttrib = 153
Const glPopClientAttrib = 154
Const glPopMatrix = 155
Const glPopName = 156
Const glPrioritizeTextures = 157
Const glPushAttrib = 158
Const glPushClientAttrib = 159
Const glPushMatrix = 160
Const glPushName = 161
Const glRasterPos = 162
Const glReadBuffer = 163
Const glReadPixels = 164
Const glRect = 165
Const glRenderMode = 166
Const glResetHistogram = 167
Const glResetMinmax = 168
Const glRotate = 169
Const glSampleCoverage = 170
Const glScale = 171
Const glScissor = 172
Const glSecondaryColor = 173
Const glSecondaryColorPointer = 174
Const glSelectBuffer = 175
Const glSeparableFilter2D = 176
Const glShadeModel = 177
Const glShaderSource = 178
Const glStencilFunc = 179
Const glStencilFuncSeparate = 180
Const glStencilMask = 181
Const glStencilMaskSeparate = 182
Const glStencilOp = 183
Const glStencilOpSeparate = 184
Const glTexCoord = 185
Const glTexCoordPointer = 186
Const glTexEnv = 187
Const glTexGen = 188
Const glTexImage1D = 189
Const glTexImage2D = 190
Const glTexImage3D = 191
Const glTexParameter = 192
Const glTexSubImage1D = 193
Const glTexSubImage2D = 194
Const glTexSubImage3D = 195
Const glTranslate = 196
Const gluBeginCurve = 197
Const gluBeginPolygon = 198
Const gluBeginSurface = 199
Const gluBeginTrim = 200
Const gluBuild1DMipmapLevels = 201
Const gluBuild1DMipmaps = 202
Const gluBuild2DMipmapLevels = 203
Const gluBuild2DMipmaps = 204
Const gluBuild3DMipmapLevels = 205
Const gluBuild3DMipmaps = 206
Const gluCheckExtension = 207
Const gluCylinder = 208
Const gluDeleteNurbsRenderer = 209
Const gluDeleteQuadric = 210
Const gluDeleteTess = 211
Const gluDisk = 212
Const gluEndCurve = 213
Const gluEndPolygon = 214
Const gluEndSurface = 215
Const gluEndTrim = 216
Const gluErrorString = 217
Const gluGetNurbsProperty = 218
Const gluGetString = 219
Const gluGetTessProperty = 220
Const gluLoadSamplingMatrices = 221
Const gluLookAt = 222
Const gluNewNurbsRenderer = 223
Const gluNewQuadric = 224
Const gluNewTess = 225
Const gluNextContour = 226
Const glUniform = 227
Const glUnmapBuffer = 228
Const gluNurbsCallback = 229
Const gluNurbsCallbackData = 230
Const gluNurbsCallbackDataEXT = 231
Const gluNurbsCurve = 232
Const gluNurbsProperty = 233
Const gluNurbsSurface = 234
Const gluOrtho2D = 235
Const gluPartialDisk = 236
Const gluPerspective = 237
Const gluPickMatrix = 238
Const gluProject = 239
Const gluPwlCurve = 240
Const gluQuadricCallback = 241
Const gluQuadricDrawStyle = 242
Const gluQuadricNormals = 243
Const gluQuadricOrientation = 244
Const gluQuadricTexture = 245
Const gluScaleImage = 246
Const glUseProgram = 247
Const gluSphere = 248
Const glValidateProgram = 249
Const glVertex = 250
Const glVertexAttrib = 251
Const glVertexAttribPointer = 252
Const glVertexPointer = 253
Const glViewport = 254
Const glWindowPos = 255




// --- GENERAL --- //

Function cbglInit(w,h,flags=0)
    SetWindow "CB Window"
    
    gDLLMemory = MakeMEMBlock(32)
    
    PokeInt gDLLMemory, 0, w
    PokeInt gDLLMemory, 4, h
    PokeInt gDLLMemory, 8, flags
    CallDLL gDLLFile, "cbglInit", gDLLMemory
EndFunction

Function cbglCls()
    CallDLL gDLLFile, "cbglCls"
EndFunction

Function cbglFlip()
    CallDLL gDLLFile, "cbglFlip"
EndFunction
 

Function cbglSetWindow(windowtitle$)
    strlen = Len(windowtitle)
    mem = MakeMEMBlock(strlen+4)
    PokeInt mem, 0, strlen
    offset=4
    For i = 1 To strlen
        PokeByte mem, offset, Asc(Mid(windowtitle, i, 1))
        offset+1
    Next i
    CallDLL gDLLFile, "cbglSetWindow", mem
    DeleteMEMBlock mem
End Function

Function cbglTerminate()
    CallDLL gDLLFile, "cbglTerminate"
    DeleteMEMBlock gDLLMemory
EndFunction


// --- GRAPHICS PRIMITIVES --- //

Function cbglColor(r,g,b,a=255)
    PokeInt gDLLMemory, 0, r
    PokeInt gDLLMemory, 4, g
    PokeInt gDLLMemory, 8, b
    PokeInt gDLLMemory, 12,a
    CallDLL gDLLFile, "cbglColor", gDLLMemory
End Function

Function cbglDot(x, y, col)
    PokeInt gDLLMemory, 0, x
    PokeInt gDLLMemory, 4, y
    PokeInt   gDLLMemory, 8, col
    CallDLL gDLLFile, "cbglDot", gDLLMemory
End Function

Function cbglLine(x1, y1, x2, y2)
    gDLLMemory = MakeMEMBlock(16)
    PokeInt gDLLMemory, 0, x1
    PokeInt gDLLMemory, 4, y1
    PokeInt gDLLMemory, 8, x2
    PokeInt gDLLMemory, 12,y2
    CallDLL gDLLFile, "cbglLine", mem
End Function

Function cbglBox(x1, y1, x2, y2, filled=0)
    PokeInt gDLLMemory, 0, x1
    PokeInt gDLLMemory, 4, y1
    PokeInt gDLLMemory, 8, x2
    PokeInt gDLLMemory, 12,y2
    PokeInt gDLLMemory, 16,filled
    CallDLL gDLLFile, "cbglBox", gDLLMemory
End Function

Function cbglCircle(x, y, r, filled=0)
    PokeInt gDLLMemory, 0, x
    PokeInt gDLLMemory, 4, y
    PokeInt gDLLMemory, 8, r
    PokeInt gDLLMemory, 12,filled
    CallDLL gDLLFile, "cbglCircle", gDLLMemory
End Function

Function cbglEllipse(x, y, a, b, filled=0)
    PokeInt gDLLMemory, 0, x
    PokeInt gDLLMemory, 4, y
    PokeInt gDLLMemory, 8, a
    PokeInt gDLLMemory, 12,b
    PokeInt   gDLLMemory, 16,filled
    CallDLL gDLLFile, "cbglEllipse", gDLLMemory
End Function



// --- IMAGES --- //

Function cbglLoadImage(filename$, filter=1)
    strlen = Len(filename)
    mem = MakeMEMBlock(strlen+8)
    If filter = 0 Then PokeInt mem, 0, 5 Else PokeInt mem, 0, filter
    PokeInt mem, 4, strlen
    offset=8
    For i = 1 To strlen
        PokeByte mem, offset, Asc(Mid(filename, i, 1))
        offset+1
    Next i
    CallDLL gDLLFile, "cbglLoadImage", mem
    ret = PeekInt(mem, 0)
    DeleteMEMBlock mem
    Return ret
End Function

Function cbglDrawImage(id, x, y, rot#=0, scale#=1, alpha=255)
    PokeInt   gDLLMemory, 0, id
    PokeInt gDLLMemory, 4, x
    PokeInt gDLLMemory, 8, y
    PokeFloat gDLLMemory, 12,rot
    PokeFloat gDLLMemory, 16,scale
    PokeInt gDLLMemory, 20,alpha
    CallDLL gDLLFile, "cbglDrawImage", gDLLMemory
End Function

Function cbglImageWidth(id)
    PokeInt gDLLMemory, 0, id
    CallDLL gDLLFile, "cbglImageWidth", gDLLMemory
    ret = PeekInt(gDLLMemory, 0)
    Return ret
End Function

Function cbglImageHeight(id)
    PokeInt gDLLMemory, 0, id
    CallDLL gDLLFile, "cbglImageHeight", gDLLMemory
    ret = PeekInt(gDLLMemory, 0)
    Return ret
End Function


// --- TEXT --- //

Function cbglText(x, y, txt$, fontImageId, scale#=1.0)
    strlen = Len(txt)
    mem = MakeMEMBlock(strlen+20)
    PokeInt mem, 0, x
    PokeInt mem, 4, y
    PokeInt mem, 8, fontImageId
    PokeFloat mem, 12, scale
    PokeInt mem, 16, strlen
    offset=20
    For i = 1 To strlen
        PokeByte mem, offset, Asc(Mid(txt, i, 1))
        offset+1
    Next i
    CallDLL gDLLFile, "cbglText", mem
    DeleteMEMBlock mem
End Function


// Tämä ei toimi
'Function cbglText2(x, y, txt$)
'    strlen = Len(txt)
'    mem = MakeMEMBlock(strlen+12)
'    PokeInt mem, 0, x
'    PokeInt mem, 4, y
'    PokeInt mem, 8, strlen
'    offset=12
'    For i = 1 To strlen
'        PokeByte mem, offset, Asc(Mid(txt, i, 1))
'        offset+1
'    Next i
'    CallDLL gDLLFile, "cbglText2", mem
'    DeleteMEMBlock mem
'End Function


// Anna tälle cbglLoadImagella ladattu fontti kuva
// Tätä ei tarvi ollenkaan
'Function cbglBuildFont(fontImageId)
'    mem = MakeMEMBlock(4)
'    PokeInt mem, 0, fontImageId
'    CallDLL gDLLFile, "cbglBuildFont", mem
'    DeleteMEMBlock mem
'End Function


// Tämä ei toimi
'Function cbglLoadFont(fontname$, fontheight, fontweight)
'    strlen = Len(fontname)
'    mem = MakeMEMBlock(strlen+12)
'    PokeInt mem, 0, fontheight
'    PokeInt mem, 4, fontweight
'    PokeInt mem, 8, strlen
'    offset=12
'    For i = 1 To strlen
'        PokeByte mem, offset, Asc(Mid(fontname, i, 1))
'        offset+1
'    Next i
'    CallDLL gDLLFile, "cbglLoadFont", mem
'    DeleteMEMBlock mem
'End Function


// --- INPUT --- //

Function cbglKeyDown(scancode)
    PokeInt gDLLMemory, 0, scancode
    CallDLL gDLLFile, "cbglKeyDown", gDLLMemory
    ret = PeekByte(gDLLMemory, 0)
    Return ret
End Function


Function cbglMouseDown(button=1)
    PokeByte gDLLMemory, 0, button
    CallDLL gDLLFile, "cbglMouseDown", gDLLMemory
    ret = PeekByte(gDLLMemory, 0)
    Return ret
End Function

Function cbglMouseX()
    CallDLL gDLLFile, "cbglMouseX", gDLLMemory
    ret = PeekInt(gDLLMemory, 0)
    Return ret
End Function

Function cbglMouseY()
    CallDLL gDLLFile, "cbglMouseY", gDLLMemory
    ret = PeekInt(gDLLMemory, 0)
    Return ret
End Function

Function cbglMouseZ()
    CallDLL gDLLFile, "cbglMouseZ", gDLLMemory
    ret = PeekInt(gDLLMemory, 0)
    Return ret
End Function


// --- OPENGL WRAPPING FUNCS --- //

Function cbgl0(cmdname)
    PokeByte gDLLMemory, 0, cmdname
    CallDLL gDLLFile, "cbgl0", gDLLMemory
End Function


Function cbgl1i(cmdname, param1)
    PokeInt gDLLMemory, 0, param1
    PokeByte gDLLMemory, 4, cmdname
    CallDLL gDLLFile, "cbgl1i", gDLLMemory
End Function

Function cbgl2i(cmdname, param1, param2)
    PokeInt gDLLMemory, 0, param1
    PokeInt gDLLMemory, 4, param2
	PokeByte gDLLMemory, 8, cmdname
    CallDLL gDLLFile, "cbgl2i", gDLLMemory
End Function

Function cbgl3i(cmdname, param1, param2, param3)
    PokeInt gDLLMemory, 0, param1
    PokeInt gDLLMemory, 4, param2
    PokeInt gDLLMemory, 8, param3
    PokeByte gDLLMemory, 12, cmdname
    CallDLL gDLLFile, "cbgl3i", gDLLMemory
End Function

Function cbgl4i(cmdname, param1, param2, param3, param4)
    PokeInt gDLLMemory, 0, param1
    PokeInt gDLLMemory, 4, param2
    PokeInt gDLLMemory, 8, param3
    PokeInt gDLLMemory, 12, param4
    PokeByte gDLLMemory, 16, cmdname
    CallDLL gDLLFile, "cbgl4i", gDLLMemory
End Function


Function cbgl1f(cmdname, param1#)
    PokeFloat gDLLMemory, 0, param1
    PokeByte gDLLMemory, 4, cmdname
    CallDLL gDLLFile, "cbgl1f", gDLLMemory
End Function


Function cbgl2f(cmdname, param1#, param2#)
    PokeFloat gDLLMemory, 0, param1
    PokeFloat gDLLMemory, 4, param2
    PokeByte gDLLMemory, 8, cmdname
    CallDLL gDLLFile, "cbgl2f", gDLLMemory
End Function

Function cbgl3f(cmdname, param1#, param2#, param3#)
    PokeFloat gDLLMemory, 0, param1
    PokeFloat gDLLMemory, 4, param2
    PokeFloat gDLLMemory, 8, param3
    PokeByte gDLLMemory, 12, cmdname
    CallDLL gDLLFile, "cbgl3f", gDLLMemory
End Function

Function cbgl4f(cmdname, param1#, param2#, param3#, param4#)
    PokeFloat gDLLMemory, 0, param1
    PokeFloat gDLLMemory, 4, param2
    PokeFloat gDLLMemory, 8, param3
    PokeFloat gDLLMemory, 12, param4
    PokeByte gDLLMemory, 16, cmdname
    CallDLL gDLLFile, "cbgl4f", gDLLMemory
End Function
Solar Eclipse
Meneillä olevat Projektit:
We're in a simulation, and God is trying to debug us.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests