CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

Projet réaliste...

djromainfr
djromainfr
Niveau 4
27 janvier 2003 à 15:55:12

Non mais c´était une idée pour que ton jeu soit plus rapide, et plus joli... mais c´est vria que tu peux passer direct au Cpp...

hs_dino
hs_dino
Niveau 9
27 janvier 2003 à 21:14:18

1 point pour toi djromainfr!
J´ai effectivement commencé par le basic sur mon amstrad cpc6128+ quand j´avais 10 ans. Ensuite, j´ai attaqué un peu l´assembleur, toujours sur cette machine.
En 1997, j´ai acheté mon 1er PC, j´ai fait un peu de QBasic, mais comme c´etait trop nase, j´ai essayé le Turbo Pascal 7.0 jusqu´an 1999 ou j´ai commencé le C++.

Seulement, et c´est là que je marque un point ; -), c´est qu´en 1990 ( quand j´avais 10 ans), si j´avais eu la possiblité de coder en C++ je n´aurais pas "perdu" 10 ans de ma vie avec des langages "moisis".

Alors j´essaye tant bien que mal d´aider les débutant a partir dans le bon chemin.

djromainfr
djromainfr
Niveau 4
27 janvier 2003 à 21:52:36

Possible que tu ais perdu 2 ans de ta vie... mais en tout cas ne ce qui me concerne je n´aurai jamais pu apprendre le Cpp directement... Maintenant ça passe comme un lettre car j´ai quand même des bases et même si la philosophie n´est pas du tout la même j´ai quand même mes repères...
est ce que pour me faire plaisir ( ;)) tu pourrais tester la demo de pure basic www.purebasic.com la version 3.51. Voila ce que j´appelle un bon basic... maintenant download ( si ta le temps car la tu bousilles ton forfait ^^) Dark Basic, tu verras a mon avis en deux troix codes la difénrence... Tiens un code pour faire un code OGL en pure basic ( c´est dans les examples...).
( dsl pour la place que ça va prendre...):

;
;
; OpenGL Test
;
; ( c) 2002 - Fantaisie Software
;
; This source is based on an ASM source code found on the web ( can´t remember which one).
;
; Axis explainations:
;
; +
; y
;
; |
; |
; + |
; x ---------\
; \
; \
; \
; z+
;
; So a rotate on the y axis will take the y axis as center. With OpenGL, we can specify
; positive And negative value. Positive values are always in the same sens as the axis
; ( like described on the schmatic, with ´+´ signs)
;
; 04/04/2002
; Recompiled without any problem with PureBasic V3
;
; 20/11/2001
; One year, later the same in PureBasic !
;
; 28/09/2000
; I´ve played a bit with OpenGL, And we can do zoom, translation, etc...
; The famous spinning cube is working ! !!
;

IncludeFile "OpenGL.pbi"

Global RollAxisX.f
Global RollAxisY.f
Global RollAxisZ.f

Global RotateSpeedX.f
Global RotateSpeedY.f
Global RotateSpeedZ.f

Global ZoomFactor.f

Procedure DrawCube(hdc)
glPushMatrix_() ; Save the original Matrix coordinates
glMatrixMode_(#GL_MODELVIEW)

glTranslatef_(0, 0, ZoomFactor) ; move it forward a bit

glRotatef_ ( RollAxisX, 1.0, 0, 0) ; rotate around X axis
glRotatef_ ( RollAxisY, 0, 1.0, 0) ; rotate around Y axis
glRotatef_ ( RollAxisZ, 0, 0, 1.0) ; rotate around Z axis

RollAxisX + RotateSpeedX
RollAxisY + RotateSpeedY
RollAxisZ + RotateSpeedZ

; clear framebuffer And depth-buffer

glClear_ ( #GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)

; draw the faces of a cube

; draw colored faces

glDisable_(#GL_LIGHTING)
glBegin_ ( #GL_QUADS)

; Build a face, composed of 4 vertex !
; glBegin() specify how the vertexes are considered. Here a group of
; 4 vertexes ( GL_QUADS) form a rectangular surface.

; Now, the color stuff: It´s r,v,b but with float values which
; can go from 0.0 To 1.0 ( 0 is . . zero And 1.0 is full intensity)

glNormal3f_ ( 0,0,1.0)
glColor3f_ ( 0,0,1.0)
glVertex3f_ ( 0.5,0.5,0.5)
glColor3f_ ( 0,1.0,1.0)
glVertex3f_ ( -0.5,0.5,0.5)
glColor3f_ ( 1.0,1.0,1.0)
glVertex3f_ ( -0.5,-0.5,0.5)
glColor3f_ ( 0,0,0)
glVertex3f_ ( 0.5,-0.5,0.5)

; The other face is the same than the previous one
; except the colour which is nice blue To white gradiant

glNormal3f_ ( 0,0,-1.0)
glColor3f_ ( 0,0,1.0)
glVertex3f_ ( -0.5,-0.5,-0.5)
glColor3f_ ( 0,0,1.0)
glVertex3f_ ( -0.5,0.5,-0.5)
glColor3f_ ( 1.0,1.0,1.0)
glVertex3f_ ( 0.5,0.5,-0.5)
glColor3f_ ( 1.0,1.0,1.0)
glVertex3f_ ( 0.5,-0.5,-0.5)

glEnd_()

; draw shaded faces

glEnable_(#GL_LIGHTING)
glEnable_(#GL_LIGHT0)
glBegin_ ( #GL_QUADS)

glNormal3f_ ( 0, 1.0, 0)
glVertex3f_ ( 0.5, 0.5, 0.5)
glVertex3f_ ( 0.5, 0.5,-0.5)
glVertex3f_ ( -0.5, 0.5,-0.5)
glVertex3f_ ( -0.5, 0.5, 0.5)

glNormal3f_ ( 0,-1.0,0)
glVertex3f_ ( -0.5,-0.5,-0.5)
glVertex3f_ ( 0.5,-0.5,-0.5)
glVertex3f_ ( 0.5,-0.5,0.5)
glVertex3f_ ( -0.5,-0.5,0.5)

glNormal3f_ ( 1.0,0,0)
glVertex3f_ ( 0.5,0.5,0.5)
glVertex3f_ ( 0.5,-0.5,0.5)
glVertex3f_ ( 0.5,-0.5,-0.5)
glVertex3f_ ( 0.5,0.5,-0.5)

glNormal3f_ ( -1.0, 0, 0)
glVertex3f_ ( -0.5,-0.5,-0.5)
glVertex3f_ ( -0.5,-0.5, 0.5)
glVertex3f_ ( -0.5, 0.5, 0.5)
glVertex3f_ ( -0.5, 0.5,-0.5)

glEnd_()

glPopMatrix_()
glFinish_()

SwapBuffers_(hdc)
EndProcedure

Procedure HandleError ( Result, Text$)
If Result = 0
MessageRequester("Error", Text$, 0)
End
EndIf
EndProcedure

pfd.PIXELFORMATDESCRIPTOR

FlatMode = 0 ; Enable Or disable the ´Flat´ rendering

WindowWidth = 600 ; The window & GLViewport dimensions
WindowHeight = 600

RotateSpeedX = 5.0 ; The speed of the rotation For the 3 axis
RotateSpeedY = 0
RotateSpeedZ = 5.0

ZoomFactor = 1 ; Distance of the camera. Negative value = zoom back

hWnd = OpenWindow(0, 10, 10, WindowWidth, WindowHeight, #PB_Window_SystemMenu, "First OpenGL Test")

hdc = GetDC_(hWnd)

pfd\nSize = SizeOf(PIXELFORMATDESCRIPTOR)
pfd\nVersion = 1
pfd\dwFlags = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER | #PFD_DRAW_TO_WINDOW
pfd\dwLayerMask = #PFD_MAIN_PLANE
pfd\iPixelType = #PFD_TYPE_RGBA
pfd\cColorBits = 16
pfd\cDepthBits = 16

pixformat = ChoosePixelFormat_(hdc, pfd)

HandleError( SetPixelFormat_(hdc, pixformat, pfd), "SetPixelFormat()")

hrc = wglCreateContext_(hdc)

HandleError( wglMakeCurrent_(hdc,hrc), "vglMakeCurrent()")

glMatrixMode_(#GL_PROJECTION)

; position viewer

glMatrixMode_ ( #GL_MODELVIEW)
glTranslatef_ ( 0, 0, -2.0)

If ( FlatMode)
glShadeModel_ ( #GL_FLAT)
Else
glShadeModel_ ( #GL_SMOOTH)
EndIf

glEnable_ ( #GL_DEPTH_TEST) ; Enabled, it slowdown a lot the rendering. It´s to be sure than the
; rendered objects are inside the z-buffer.

glEnable_ ( #GL_CULL_FACE) ; This will enhance the rendering speed as all the back face will be
; ignored. This works only with CLOSED objects like a cube... Singles
; planes surfaces will be visibles only on one side.

HandleError( glViewport_ ( 0, 0, WindowWidth-30, WindowHeight-30), "GLViewPort()") ; A rectangle which define the OpenGL output zone

While Quit = 0

Repeat
EventID = WindowEvent()

Select EventID
Case #PB_EventCloseWindow
Quit = 1
EndSelect

Until EventID = 0

DrawCube(hdc)
Wend

End

Bon ok? Bon ok, c bon t´es chaud? bon voila le code pour faire un cube en Db: ( bon ok celui la il ne subit aucune rotation ^^), et dnas celui la ya pas le choix, c´est direct X ou direct X, et le moteur 3D est imposé...:

Make object cube 1,100,100,100

Bon voila ça se passe de commentaires... Tout ça pour te dire que les basic sont de qualité variables... le but n´étant pas d´ecrire le plus de lignes ( je précise) mais dans DB tt est guidé et pour moi aucune liberté n´est accordée. Prend le temps un jour de tester pour savoir sur quoi bosse les autres, c´est toujours utile.

Sinon ah oui dernier truc ( dsl pour l´argumentation de 10 pages ^^); moi personnelement je ne pense pas avoir les capacités pour faire un moteur 3D entier en C++... Mais il est fort probable que dans un an ou moins je te sortirai pas du tout la même chose. Moi je prends mon temps je suis jeune, j´apprends, je n´ai pas commencé par le C++ mais j´avance suremement : )

Sous forums
  • Aide à l'achat Mac
  • Steam Deck
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Internet
  • Macintosh
  • Hardware
La vidéo du moment