### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: USING SDL2 UNIT. rotate a texture by an angle.  (Read 9159 times)

#### DiCri

• Full Member
• Posts: 151
• My goal : Build a game
##### USING SDL2 UNIT. rotate a texture by an angle.
« on: August 08, 2016, 06:27:48 pm »
I mean. Is it possible to rotate a texture image not only x and y but z too??  For example if i rotate an image for 45° by Z, it's like there is a isosceles trapezoid... If u don't understand tell me. Please help
I'm a game developer.. Now studying..
http://manueldicriscito.altervista.org/DinoLand.zip

#### User137

• Hero Member
• Posts: 1791
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #1 on: August 08, 2016, 09:05:08 pm »
Doesn't seem like it's possible. When you start needing to bend or draw textured triangles and so on, it falls on to OpenGL.

#### Handoko

• Hero Member
• Posts: 3765
• My goal: build my own game engine using Lazarus
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #2 on: August 08, 2016, 09:44:58 pm »
SDL does not provide 3D features directly, but it allows integration of OpenGL into SDL.
https://www.libsdl.org/release/SDL-1.2.15/docs/html/guidevideoopengl.html

So if you want to learn how to create and control 3D in SDL, you have to learn OpenGL. Finding OpenGL tutorials is easy, but almost all of them are in C/C++ language.

For using OpenGL on Free Pascal, you will need these units:
gl, glu, glext, glut, glx

The main unit is gl which provides the main functionality, the others are not required but they offer some extra functions.

If you use Lazarus, it will be easier. Simply drop TOpenGLControl on the form and put your drawing command in OnPaint event.

http://wiki.freepascal.org/OpenGL
http://wiki.freepascal.org/OpenGL_Tutorial

SDL is a good engine for 2D games. Although it allows you to create 3D graphics, it will be wiser to pick tools specialize for 3D for developing 3D games. Like Castle Game Engine and GLScene.
« Last Edit: August 08, 2016, 09:48:03 pm by Handoko »

#### lainz

• Hero Member
• Posts: 3709
• Leandro Diaz
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #3 on: August 09, 2016, 12:53:22 am »
Why you don't learn C# and use Unity? It has a lot of stuff like transform.rotation as you say ready to use with a single line of code and it's free for making games...

#### DiCri

• Full Member
• Posts: 151
• My goal : Build a game
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #4 on: August 09, 2016, 02:22:38 am »
Why you don't learn C# and use Unity? It has a lot of stuff like transform.rotation as you say ready to use with a single line of code and it's free for making games...
I want to be a real programmer.. and my dream will never stop
I'm a game developer.. Now studying..
http://manueldicriscito.altervista.org/DinoLand.zip

#### lainz

• Hero Member
• Posts: 3709
• Leandro Diaz
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #5 on: August 09, 2016, 03:11:49 am »
Why you don't learn C# and use Unity? It has a lot of stuff like transform.rotation as you say ready to use with a single line of code and it's free for making games...
I want to be a real programmer.. and my dream will never stop

Real programmers use tools too. You can be a real programmer using unity or lazarus.

#### DiCri

• Full Member
• Posts: 151
• My goal : Build a game
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #6 on: August 20, 2016, 11:06:30 am »
Why you don't learn C# and use Unity? It has a lot of stuff like transform.rotation as you say ready to use with a single line of code and it's free for making games...
I want to be a real programmer.. and my dream will never stop

Real programmers use tools too. You can be a real programmer using unity or lazarus.
Is cocos creator good?
I'm a game developer.. Now studying..
http://manueldicriscito.altervista.org/DinoLand.zip

#### lainz

• Hero Member
• Posts: 3709
• Leandro Diaz
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #7 on: August 20, 2016, 12:29:44 pm »
Is cocos creator good?

You need to try then decide who is the best.

#### Handoko

• Hero Member
• Posts: 3765
• My goal: build my own game engine using Lazarus
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #8 on: August 20, 2016, 02:11:37 pm »
Cocos2d is one of the free game engine, which has good reputation in indie developer world. Cocos Creator is a complete package of game development tools including Cocos2d + extra things. If you have money, you may interested with Unity, which I think probably the best because when I google the web, I always get good reviews about Unity.

You can't create 3D games using Cocos2d. If you want to create 3D games you may try Godot. I followed the tutorials and downloaded the demos, wow it's so easy. The 3D demo also can run on my Android phone. I was surprised how easy it is to build cross platform games.

I don't use Godot because it's not what I'm looking for. As what lainz said, only you can tell which is best to you.

http://cocos2d-x.org/products
https://store.unity.com/
https://godotengine.org/
http://www.indiedb.com/engines
« Last Edit: August 20, 2016, 02:17:57 pm by Handoko »

#### lainz

• Hero Member
• Posts: 3709
• Leandro Diaz
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #9 on: August 20, 2016, 03:20:40 pm »
Unity is what I use, but I use the personal edition that now contains everything the same as the pro version, except for the splash screen that says made with unity personal edition.

If you win more than 100.00 usd per year with your Unity games you need to buy the pro, else you can use the personal edition for small projects.

For example I use it to create indie games, one of them: https://lainz.itch.io/power-sphere

You can build directly in Windows for Android, Linux, Mac, and other portable devices, Windows store, Web and consoles (in some cases you need an extra license).

It has a lot of tutorials in video and an extensive documentation.

#### Handoko

• Hero Member
• Posts: 3765
• My goal: build my own game engine using Lazarus
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #10 on: August 20, 2016, 05:15:43 pm »
If you win more than 100.00 usd per year with your Unity games you need to buy the pro, else you can use the personal edition for small projects.

Interesting. How to win money with Unity games? Do they have contests? Can we sell games created using Unity personal edition?

About the paid version, do we need to renew the license every year?

You Power Sphere has potential. If you add some graphics, eye candies and random moving monsters - like Sonic 3D, it can be a great arcade game too.

#### lainz

• Hero Member
• Posts: 3709
• Leandro Diaz
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #11 on: August 20, 2016, 05:28:10 pm »
Well you can sell your android games in google play and windows games in steam, itch.io or game jolt . And yes with the personal edition you can sell. You can do ios and mac too and sell in their app stores.

I dont know about the paid version you need to go to unity website and see that there are many  pro editions depending on your needs.

Is our second game im learning each day how to use it. Now for 2d games too.

#### Handoko

• Hero Member
• Posts: 3765
• My goal: build my own game engine using Lazarus
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #12 on: August 20, 2016, 08:19:59 pm »
We know, Unity is great. But it is limited, unless we're willing to pay to unlock the extra features. I guess you know Castle Game Engine and already saw someone using it to write games recently. It's open source and written using FPC (if I'm not wrong).

May I ask you, why don't you use Castle Game Engine?

#### lainz

• Hero Member
• Posts: 3709
• Leandro Diaz
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #13 on: August 20, 2016, 10:29:37 pm »
I supose because unity is easier. Everything is drag-and-drop. And I don't mind having a splash screen, but I have the features I need at the same time.

#### User137

• Hero Member
• Posts: 1791
##### Re: USING SDL2 UNIT. rotate a texture by an angle.
« Reply #14 on: August 21, 2016, 04:16:45 am »
If you win more than 100.00 usd per year with your Unity games you need to buy the pro, else you can use the personal edition for small projects.

Interesting. How to win money with Unity games? Do they have contests? Can we sell games created using Unity personal edition?

About the paid version, do we need to renew the license every year?
He meant selling specifically, if your personal edition made game sells more than 100000 usd or something is when you would have to buy Pro. But then if you do get that kind of profit, money for Pro version isn't a problem anymore right?

Good things about Unity are how the same project can be compiled directly onto all platforms, including android and apple mobile phones and linux among others. It's got extremely active forums where you can find any game making related question answered sometimes within minutes. Fully fleshed out multiplayer internet components, physics built in and so on. On top of that, it's not a "game maker" as you would traditionally expect. Sure you can just drag objects around and hit play to test it on screen, but at the same time it has an active C# script debugger. Arguably as a language it is even more feature rich than Pascal is, sad to say, with things like generics much easier to approach and use.