Initial commit
17
LICENSE
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
Copyright (C) 2016 Milan Nikolic (gen2brain)
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
48
README.md
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
## raylib-go [](https://godoc.org/github.com/gen2brain/raylib-go/raylib)
|
||||||
|
|
||||||
|
Golang bindings for [raylib](http://www.raylib.com/), a simple and easy-to-use library to learn videogames programming.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
* [raylib](http://www.raylib.com/)
|
||||||
|
* [GLFW3](http://www.glfw.org/)
|
||||||
|
* [OpenAL Soft](http://kcat.strangesoft.net/openal.html)
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
go get -v github.com/gen2brain/raylib-go
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "github.com/gen2brain/raylib-go/raylib"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - basic window")
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Check more [examples](https://github.com/gen2brain/raylib-go/examples) organized by raylib modules.
|
||||||
|
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
raylib-go is licensed under an unmodified zlib/libpng license. View [LICENSE](https://github.com/gen2brain/raylib-go/blob/master/LICENSE).
|
7
easings/README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
## easings [](https://godoc.org/github.com/gen2brain/raylib-go/easings)
|
||||||
|
|
||||||
|
Useful easing functions for values animation.
|
||||||
|
|
||||||
|
A port of Robert Penner's [easing equations](http://robertpenner.com/easing/).
|
||||||
|
|
||||||
|

|
263
easings/easings.go
Normal file
|
@ -0,0 +1,263 @@
|
||||||
|
// Useful easing functions for values animation
|
||||||
|
//
|
||||||
|
// A port of Robert Penner's easing equations (http://robertpenner.com/easing/)
|
||||||
|
package easings
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Linear Easing functions
|
||||||
|
|
||||||
|
func LinearNone(t, b, c, d float32) float32 {
|
||||||
|
return c*t/d + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func LinearIn(t, b, c, d float32) float32 {
|
||||||
|
return c*t/d + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func LinearOut(t, b, c, d float32) float32 {
|
||||||
|
return c*t/d + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func LinearInOut(t, b, c, d float32) float32 {
|
||||||
|
return c*t/d + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sine Easing functions
|
||||||
|
|
||||||
|
func SineIn(t, b, c, d float32) float32 {
|
||||||
|
return -c*float32(math.Cos(float64(t/d)*(math.Pi/2))) + c + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func SineOut(t, b, c, d float32) float32 {
|
||||||
|
return c*float32(math.Sin(float64(t/d)*(math.Pi/2))) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func SineInOut(t, b, c, d float32) float32 {
|
||||||
|
return -c/2*(float32(math.Cos(math.Pi*float64(t/d)))-1) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
// Circular Easing functions
|
||||||
|
|
||||||
|
func CircIn(t, b, c, d float32) float32 {
|
||||||
|
t = t / d
|
||||||
|
return -c*(float32(math.Sqrt(float64(1-t*t)))-1) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func CircOut(t, b, c, d float32) float32 {
|
||||||
|
return c*float32(math.Sqrt(1-float64((t/d-1)*t))) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func CircInOut(t, b, c, d float32) float32 {
|
||||||
|
t = t / d * 2
|
||||||
|
|
||||||
|
if t < 1 {
|
||||||
|
return -c/2*(float32(math.Sqrt(float64(1-t*t)))-1) + b
|
||||||
|
} else {
|
||||||
|
t = t - 2
|
||||||
|
return c/2*(float32(math.Sqrt(1-float64(t*t)))+1) + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cubic Easing functions
|
||||||
|
|
||||||
|
func CubicIn(t, b, c, d float32) float32 {
|
||||||
|
t = t / d
|
||||||
|
return c*t*t*t + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func CubicOut(t, b, c, d float32) float32 {
|
||||||
|
t = t/d - 1
|
||||||
|
return c*(t*t*t+1) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func CubicInOut(t, b, c, d float32) float32 {
|
||||||
|
t = t / d * 2
|
||||||
|
if t < 1 {
|
||||||
|
return (c/2*t*t*t + b)
|
||||||
|
} else {
|
||||||
|
t = t - 2
|
||||||
|
return c/2*(t*t*t+2) + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quadratic Easing functions
|
||||||
|
|
||||||
|
func QuadIn(t, b, c, d float32) float32 {
|
||||||
|
t = t / d
|
||||||
|
return c*t*t + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func QuadOut(t, b, c, d float32) float32 {
|
||||||
|
t = t / d
|
||||||
|
return (-c*t*(t-2) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func QuadInOut(t, b, c, d float32) float32 {
|
||||||
|
t = t / d * 2
|
||||||
|
if t < 1 {
|
||||||
|
return ((c / 2) * (t * t)) + b
|
||||||
|
} else {
|
||||||
|
return -c/2*((t-1)*(t-3)-1) + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exponential Easing functions
|
||||||
|
|
||||||
|
func ExpoIn(t, b, c, d float32) float32 {
|
||||||
|
if t == 0 {
|
||||||
|
return b
|
||||||
|
} else {
|
||||||
|
return (c*float32(math.Pow(2, 10*float64(t/d-1))) + b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExpoOut(t, b, c, d float32) float32 {
|
||||||
|
if t == d {
|
||||||
|
return (b + c)
|
||||||
|
} else {
|
||||||
|
return c*(-float32(math.Pow(2, -10*float64(t/d)))+1) + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExpoInOut(t, b, c, d float32) float32 {
|
||||||
|
if t == 0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
if t == d {
|
||||||
|
return (b + c)
|
||||||
|
}
|
||||||
|
|
||||||
|
t = t / d * 2
|
||||||
|
|
||||||
|
if t < 1 {
|
||||||
|
return (c/2*float32(math.Pow(2, 10*float64(t-1))) + b)
|
||||||
|
} else {
|
||||||
|
t = t - 1
|
||||||
|
return (c/2*(-float32(math.Pow(2, -10*float64(t)))+2) + b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Back Easing functions
|
||||||
|
|
||||||
|
func BackIn(t, b, c, d float32) float32 {
|
||||||
|
s := float32(1.70158)
|
||||||
|
t = t / d
|
||||||
|
return c*t*t*((s+1)*t-s) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func BackOut(t, b, c, d float32) float32 {
|
||||||
|
s := float32(1.70158)
|
||||||
|
t = t/d - 1
|
||||||
|
return c*(t*t*((s+1)*t+s)+1) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func BackInOut(t, b, c, d float32) float32 {
|
||||||
|
s := float32(1.70158)
|
||||||
|
s = s * 1.525
|
||||||
|
t = t / d * 2
|
||||||
|
|
||||||
|
if t < 1 {
|
||||||
|
return c/2*(t*t*((s+1)*t-s)) + b
|
||||||
|
} else {
|
||||||
|
t = t - 2
|
||||||
|
return c/2*(t*t*((s+1)*t+s)+2) + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bounce Easing functions
|
||||||
|
|
||||||
|
func BounceIn(t, b, c, d float32) float32 {
|
||||||
|
return (c - BounceOut(d-t, 0, c, d) + b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BounceOut(t, b, c, d float32) float32 {
|
||||||
|
t = t / d
|
||||||
|
if t < (1 / 2.75) {
|
||||||
|
return (c*(7.5625*t*t) + b)
|
||||||
|
} else if t < (2 / 2.75) {
|
||||||
|
t = t - (1.5 / 2.75)
|
||||||
|
return c*(7.5625*t*t+0.75) + b
|
||||||
|
} else if t < (2.5 / 2.75) {
|
||||||
|
t = t - (2.25 / 2.75)
|
||||||
|
return c*(7.5625*t*t+0.9375) + b
|
||||||
|
} else {
|
||||||
|
t = t - (2.625 / 2.75)
|
||||||
|
return c*(7.5625*t*t+0.984375) + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func BounceInOut(t, b, c, d float32) float32 {
|
||||||
|
if t < d/2 {
|
||||||
|
return BounceIn(t*2, 0, c, d)*0.5 + b
|
||||||
|
} else {
|
||||||
|
return BounceOut(t*2-d, 0, c, d)*0.5 + c*0.5 + b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Elastic Easing functions
|
||||||
|
|
||||||
|
func ElasticIn(t, b, c, d float32) float32 {
|
||||||
|
if t == 0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
t = t / d
|
||||||
|
|
||||||
|
if t == 1 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d * 0.3
|
||||||
|
a := c
|
||||||
|
s := p / 4
|
||||||
|
postFix := a * float32(math.Pow(2, 10*float64(t-1)))
|
||||||
|
|
||||||
|
return -(postFix * float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p)))) + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func ElasticOut(t, b, c, d float32) float32 {
|
||||||
|
if t == 0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
t = t / d
|
||||||
|
|
||||||
|
if t == 1 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d * 0.3
|
||||||
|
a := c
|
||||||
|
s := p / 4
|
||||||
|
|
||||||
|
return a*float32(math.Pow(2, -10*float64(t)))*float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p))) + c + b
|
||||||
|
}
|
||||||
|
|
||||||
|
func ElasticInOut(t, b, c, d float32) float32 {
|
||||||
|
if t == 0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
t = t / d * 2
|
||||||
|
|
||||||
|
if t == 2 {
|
||||||
|
return b + c
|
||||||
|
}
|
||||||
|
|
||||||
|
p := d * (0.3 * 1.5)
|
||||||
|
a := c
|
||||||
|
s := p / 4
|
||||||
|
|
||||||
|
if t < 1 {
|
||||||
|
t = t - 1
|
||||||
|
postFix := a * float32(math.Pow(2, 10*float64(t)))
|
||||||
|
return -0.5*(postFix*float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p)))) + b
|
||||||
|
} else {
|
||||||
|
t = t - 1
|
||||||
|
postFix := a * float32(math.Pow(2, -10*(float64(t))))
|
||||||
|
return postFix*float32(math.Sin(float64(t*d-s)*(2*math.Pi)/float64(p)))*0.5 + c + b
|
||||||
|
}
|
||||||
|
}
|
32
examples/android/example/android/AndroidManifest.xml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.github.gen2brain.raylib.go"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="25" />
|
||||||
|
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||||
|
|
||||||
|
<!-- We do not have Java code. Therefore android:hasCode is set to false. -->
|
||||||
|
<application android:allowBackup="false" android:hasCode="false"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:icon="@drawable/icon"
|
||||||
|
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
|
||||||
|
|
||||||
|
<!-- Our activity is the built-in NativeActivity framework class. -->
|
||||||
|
<activity android:name="android.app.NativeActivity"
|
||||||
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
|
android:screenOrientation="landscape"
|
||||||
|
android:clearTaskOnLaunch="true">
|
||||||
|
|
||||||
|
<!-- Tell NativeActivity the name of our .so -->
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="example" />
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
BIN
examples/android/example/android/assets/alagard.rbmf
Normal file
BIN
examples/android/example/android/assets/ambient.ogg
Normal file
BIN
examples/android/example/android/assets/coin.wav
Normal file
BIN
examples/android/example/android/assets/raylib_logo.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
92
examples/android/example/android/build.xml
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="example" default="help">
|
||||||
|
|
||||||
|
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||||
|
It contains the path to the SDK. It should *NOT* be checked into
|
||||||
|
Version Control Systems. -->
|
||||||
|
<property file="local.properties" />
|
||||||
|
|
||||||
|
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||||
|
'android' tool to add properties to it.
|
||||||
|
This is the place to change some Ant specific build properties.
|
||||||
|
Here are some properties you may want to change/update:
|
||||||
|
|
||||||
|
source.dir
|
||||||
|
The name of the source directory. Default is 'src'.
|
||||||
|
out.dir
|
||||||
|
The name of the output directory. Default is 'bin'.
|
||||||
|
|
||||||
|
For other overridable properties, look at the beginning of the rules
|
||||||
|
files in the SDK, at tools/ant/build.xml
|
||||||
|
|
||||||
|
Properties related to the SDK location or the project target should
|
||||||
|
be updated using the 'android' tool with the 'update' action.
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<property file="ant.properties" />
|
||||||
|
|
||||||
|
<!-- if sdk.dir was not set from one of the property file, then
|
||||||
|
get it from the ANDROID_HOME env var.
|
||||||
|
This must be done before we load project.properties since
|
||||||
|
the proguard config can use sdk.dir -->
|
||||||
|
<property environment="env" />
|
||||||
|
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||||
|
<isset property="env.ANDROID_HOME" />
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<!-- The project.properties file is created and updated by the 'android'
|
||||||
|
tool, as well as ADT.
|
||||||
|
|
||||||
|
This contains project specific properties such as project target, and library
|
||||||
|
dependencies. Lower level build properties are stored in ant.properties
|
||||||
|
(or in .classpath for Eclipse projects).
|
||||||
|
|
||||||
|
This file is an integral part of the build system for your
|
||||||
|
application and should be checked into Version Control Systems. -->
|
||||||
|
<loadproperties srcFile="project.properties" />
|
||||||
|
|
||||||
|
<!-- quick check on sdk.dir -->
|
||||||
|
<fail
|
||||||
|
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||||
|
unless="sdk.dir"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Import per project custom build rules if present at the root of the project.
|
||||||
|
This is the place to put custom intermediary targets such as:
|
||||||
|
-pre-build
|
||||||
|
-pre-compile
|
||||||
|
-post-compile (This is typically used for code obfuscation.
|
||||||
|
Compiled code location: ${out.classes.absolute.dir}
|
||||||
|
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||||
|
-post-package
|
||||||
|
-post-build
|
||||||
|
-pre-clean
|
||||||
|
-->
|
||||||
|
<import file="custom_rules.xml" optional="true" />
|
||||||
|
|
||||||
|
<!-- Import the actual build file.
|
||||||
|
|
||||||
|
To customize existing targets, there are two options:
|
||||||
|
- Customize only one target:
|
||||||
|
- copy/paste the target into this file, *before* the
|
||||||
|
<import> task.
|
||||||
|
- customize it to your needs.
|
||||||
|
- Customize the whole content of build.xml
|
||||||
|
- copy/paste the content of the rules files (minus the top node)
|
||||||
|
into this file, replacing the <import> task.
|
||||||
|
- customize to your needs.
|
||||||
|
|
||||||
|
***********************
|
||||||
|
****** IMPORTANT ******
|
||||||
|
***********************
|
||||||
|
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||||
|
in order to avoid having your file be overridden by tools such as "android update project"
|
||||||
|
-->
|
||||||
|
<!-- version-tag: 1 -->
|
||||||
|
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||||
|
|
||||||
|
</project>
|
2
examples/android/example/android/project.properties
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Project target.
|
||||||
|
target=android-25
|
BIN
examples/android/example/android/res/drawable-hdpi/icon.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
examples/android/example/android/res/drawable-ldpi/icon.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
examples/android/example/android/res/drawable-mdpi/icon.png
Normal file
After Width: | Height: | Size: 922 B |
4
examples/android/example/android/res/values/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">raylib-go</string>
|
||||||
|
</resources>
|
125
examples/android/example/main.go
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Logo = iota
|
||||||
|
Title
|
||||||
|
GamePlay
|
||||||
|
Ending
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
raylib.SetCallbackFunc(run)
|
||||||
|
}
|
||||||
|
|
||||||
|
func run(app unsafe.Pointer) {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagVsyncHint)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, app)
|
||||||
|
|
||||||
|
raylib.InitAudioDevice()
|
||||||
|
|
||||||
|
currentScreen := Logo
|
||||||
|
windowShouldClose := false
|
||||||
|
|
||||||
|
texture := raylib.LoadTexture("raylib_logo.png") // Load texture (placed on assets folder)
|
||||||
|
fx := raylib.LoadSound("coin.wav") // Load WAV audio file (placed on assets folder)
|
||||||
|
ambient := raylib.LoadMusicStream("ambient.ogg") // Load music
|
||||||
|
|
||||||
|
raylib.PlayMusicStream(ambient)
|
||||||
|
|
||||||
|
framesCounter := 0 // Used to count frames
|
||||||
|
|
||||||
|
//raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !windowShouldClose {
|
||||||
|
raylib.UpdateMusicStream(ambient)
|
||||||
|
|
||||||
|
if raylib.IsKeyDown(raylib.KeyBack) {
|
||||||
|
windowShouldClose = true
|
||||||
|
}
|
||||||
|
|
||||||
|
switch currentScreen {
|
||||||
|
case Logo:
|
||||||
|
framesCounter++ // Count frames
|
||||||
|
|
||||||
|
// Wait for 4 seconds (240 frames) before jumping to Title screen
|
||||||
|
if framesCounter > 240 {
|
||||||
|
currentScreen = Title
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case Title:
|
||||||
|
// Press enter to change to GamePlay screen
|
||||||
|
if raylib.IsGestureDetected(raylib.GestureTap) {
|
||||||
|
raylib.PlaySound(fx)
|
||||||
|
currentScreen = GamePlay
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case GamePlay:
|
||||||
|
// Press enter to change to Ending screen
|
||||||
|
if raylib.IsGestureDetected(raylib.GestureTap) {
|
||||||
|
raylib.PlaySound(fx)
|
||||||
|
currentScreen = Ending
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case Ending:
|
||||||
|
// Press enter to return to Title screen
|
||||||
|
if raylib.IsGestureDetected(raylib.GestureTap) {
|
||||||
|
raylib.PlaySound(fx)
|
||||||
|
currentScreen = Title
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
switch currentScreen {
|
||||||
|
case Logo:
|
||||||
|
raylib.DrawText("LOGO SCREEN", 20, 20, 40, raylib.LightGray)
|
||||||
|
raylib.DrawTexture(texture, screenWidth/2-texture.Width/2, screenHeight/2-texture.Height/2, raylib.White)
|
||||||
|
raylib.DrawText("WAIT for 4 SECONDS...", 290, 400, 20, raylib.Gray)
|
||||||
|
break
|
||||||
|
case Title:
|
||||||
|
raylib.DrawRectangle(0, 0, screenWidth, screenHeight, raylib.Green)
|
||||||
|
raylib.DrawText("TITLE SCREEN", 20, 20, 40, raylib.DarkGreen)
|
||||||
|
raylib.DrawText("TAP SCREEN to JUMP to GAMEPLAY SCREEN", 160, 220, 20, raylib.DarkGreen)
|
||||||
|
break
|
||||||
|
case GamePlay:
|
||||||
|
raylib.DrawRectangle(0, 0, screenWidth, screenHeight, raylib.Purple)
|
||||||
|
raylib.DrawText("GAMEPLAY SCREEN", 20, 20, 40, raylib.Maroon)
|
||||||
|
raylib.DrawText("TAP SCREEN to JUMP to ENDING SCREEN", 170, 220, 20, raylib.Maroon)
|
||||||
|
break
|
||||||
|
case Ending:
|
||||||
|
raylib.DrawRectangle(0, 0, screenWidth, screenHeight, raylib.Blue)
|
||||||
|
raylib.DrawText("ENDING SCREEN", 20, 20, 40, raylib.DarkBlue)
|
||||||
|
raylib.DrawText("TAP SCREEN to RETURN to TITLE SCREEN", 160, 220, 20, raylib.DarkBlue)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadSound(fx) // Unload sound data
|
||||||
|
raylib.UnloadMusicStream(ambient) // Unload music stream data
|
||||||
|
raylib.CloseAudioDevice() // Close audio device (music streaming is automatically stopped)
|
||||||
|
raylib.UnloadTexture(texture) // Unload texture data
|
||||||
|
raylib.CloseWindow() // Close window
|
||||||
|
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
}
|
121
examples/audio/module_playing/main.go
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
const MaxCircles = 64
|
||||||
|
|
||||||
|
type CircleWave struct {
|
||||||
|
Position raylib.Vector2
|
||||||
|
Radius float32
|
||||||
|
Alpha float32
|
||||||
|
Speed float32
|
||||||
|
Color raylib.Color
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagMsaa4xHint) // NOTE: Try to enable MSAA 4X
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)")
|
||||||
|
|
||||||
|
raylib.InitAudioDevice()
|
||||||
|
|
||||||
|
colors := []raylib.Color{
|
||||||
|
raylib.Orange, raylib.Red, raylib.Gold, raylib.Lime, raylib.Blue,
|
||||||
|
raylib.Violet, raylib.Brown, raylib.LightGray, raylib.Pink,
|
||||||
|
raylib.Yellow, raylib.Green, raylib.SkyBlue, raylib.Purple, raylib.Beige,
|
||||||
|
}
|
||||||
|
|
||||||
|
circles := make([]CircleWave, MaxCircles)
|
||||||
|
|
||||||
|
for i := MaxCircles - 1; i >= 0; i-- {
|
||||||
|
c := CircleWave{}
|
||||||
|
|
||||||
|
c.Alpha = 0
|
||||||
|
c.Radius = float32(raylib.GetRandomValue(10, 40))
|
||||||
|
|
||||||
|
x := raylib.GetRandomValue(int32(c.Radius), screenWidth-int32(c.Radius))
|
||||||
|
y := raylib.GetRandomValue(int32(c.Radius), screenHeight-int32(c.Radius))
|
||||||
|
c.Position = raylib.NewVector2(float32(x), float32(y))
|
||||||
|
|
||||||
|
c.Speed = float32(raylib.GetRandomValue(1, 100)) / 20000.0
|
||||||
|
c.Color = colors[raylib.GetRandomValue(0, int32(len(colors)-1))]
|
||||||
|
|
||||||
|
circles[i] = c
|
||||||
|
}
|
||||||
|
|
||||||
|
xm := raylib.LoadMusicStream("mini1111.xm")
|
||||||
|
raylib.PlayMusicStream(xm)
|
||||||
|
|
||||||
|
pause := false
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateMusicStream(xm) // Update music buffer with new stream data
|
||||||
|
|
||||||
|
// Restart music playing (stop and play)
|
||||||
|
if raylib.IsKeyPressed(raylib.KeySpace) {
|
||||||
|
raylib.StopMusicStream(xm)
|
||||||
|
raylib.PlayMusicStream(xm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause/Resume music playing
|
||||||
|
if raylib.IsKeyPressed(raylib.KeyP) {
|
||||||
|
pause = !pause
|
||||||
|
|
||||||
|
if pause {
|
||||||
|
raylib.PauseMusicStream(xm)
|
||||||
|
} else {
|
||||||
|
raylib.ResumeMusicStream(xm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get timePlayed scaled to bar dimensions
|
||||||
|
timePlayed := int32(raylib.GetMusicTimePlayed(xm)/raylib.GetMusicTimeLength(xm)*float32(screenWidth-40)) * 2
|
||||||
|
|
||||||
|
// Color circles animation
|
||||||
|
for i := MaxCircles - 1; (i >= 0) && !pause; i-- {
|
||||||
|
circles[i].Alpha += circles[i].Speed
|
||||||
|
circles[i].Radius += circles[i].Speed * 10.0
|
||||||
|
|
||||||
|
if circles[i].Alpha > 1.0 {
|
||||||
|
circles[i].Speed *= -1
|
||||||
|
}
|
||||||
|
|
||||||
|
if circles[i].Alpha <= 0.0 {
|
||||||
|
circles[i].Alpha = 0.0
|
||||||
|
circles[i].Radius = float32(raylib.GetRandomValue(10, 40))
|
||||||
|
circles[i].Position.X = float32(raylib.GetRandomValue(int32(circles[i].Radius), screenWidth-int32(circles[i].Radius)))
|
||||||
|
circles[i].Position.Y = float32(raylib.GetRandomValue(int32(circles[i].Radius), screenHeight-int32(circles[i].Radius)))
|
||||||
|
circles[i].Color = colors[raylib.GetRandomValue(0, 13)]
|
||||||
|
circles[i].Speed = float32(raylib.GetRandomValue(1, 100)) / 20000.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
for i := MaxCircles - 1; i >= 0; i-- {
|
||||||
|
raylib.DrawCircleV(circles[i].Position, float32(circles[i].Radius), raylib.Fade(circles[i].Color, circles[i].Alpha))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw time bar
|
||||||
|
raylib.DrawRectangle(20, screenHeight-20-12, screenWidth-40, 12, raylib.LightGray)
|
||||||
|
raylib.DrawRectangle(20, screenHeight-20-12, timePlayed, 12, raylib.Maroon)
|
||||||
|
raylib.DrawRectangleLines(20, screenHeight-20-12, screenWidth-40, 12, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadMusicStream(xm)
|
||||||
|
|
||||||
|
raylib.CloseAudioDevice()
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
BIN
examples/audio/module_playing/mini1111.xm
Normal file
BIN
examples/audio/music_stream/guitar_noodling.ogg
Normal file
60
examples/audio/music_stream/main.go
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [audio] example - music playing (streaming)")
|
||||||
|
raylib.InitAudioDevice()
|
||||||
|
|
||||||
|
music := raylib.LoadMusicStream("guitar_noodling.ogg")
|
||||||
|
pause := false
|
||||||
|
|
||||||
|
raylib.PlayMusicStream(music)
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateMusicStream(music) // Update music buffer with new stream data
|
||||||
|
|
||||||
|
// Restart music playing (stop and play)
|
||||||
|
if raylib.IsKeyPressed(raylib.KeySpace) {
|
||||||
|
raylib.StopMusicStream(music)
|
||||||
|
raylib.PlayMusicStream(music)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause/Resume music playing
|
||||||
|
if raylib.IsKeyPressed(raylib.KeyP) {
|
||||||
|
pause = !pause
|
||||||
|
|
||||||
|
if pause {
|
||||||
|
raylib.PauseMusicStream(music)
|
||||||
|
} else {
|
||||||
|
raylib.ResumeMusicStream(music)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get timePlayed scaled to bar dimensions (400 pixels)
|
||||||
|
timePlayed := raylib.GetMusicTimePlayed(music) / raylib.GetMusicTimeLength(music) * 100 * 4
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
raylib.DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(200, 200, 400, 12, raylib.LightGray)
|
||||||
|
raylib.DrawRectangle(200, 200, int32(timePlayed), 12, raylib.Maroon)
|
||||||
|
raylib.DrawRectangleLines(200, 200, 400, 12, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, raylib.LightGray)
|
||||||
|
raylib.DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadMusicStream(music) // Unload music stream buffers from RAM
|
||||||
|
raylib.CloseAudioDevice() // Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
79
examples/audio/raw_stream/main.go
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [audio] example - raw audio streaming")
|
||||||
|
|
||||||
|
raylib.InitAudioDevice()
|
||||||
|
|
||||||
|
maxSamples := 20000
|
||||||
|
|
||||||
|
// Init raw audio stream (sample rate: 22050, sample size: 32bit-float, channels: 1-mono)
|
||||||
|
stream := raylib.InitAudioStream(22050, 32, 1)
|
||||||
|
|
||||||
|
//// Fill audio stream with some samples (sine wave)
|
||||||
|
data := make([]float32, maxSamples)
|
||||||
|
|
||||||
|
for i := 0; i < maxSamples; i++ {
|
||||||
|
data[i] = float32(math.Sin(float64((2*raylib.Pi*float32(i))/2) * raylib.Deg2rad))
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: The generated MAX_SAMPLES do not fit to close a perfect loop
|
||||||
|
// for that reason, there is a clip everytime audio stream is looped
|
||||||
|
raylib.PlayAudioStream(stream)
|
||||||
|
|
||||||
|
totalSamples := int32(maxSamples)
|
||||||
|
samplesLeft := int32(totalSamples)
|
||||||
|
|
||||||
|
position := raylib.NewVector2(0, 0)
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(30)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
// Refill audio stream if required
|
||||||
|
if raylib.IsAudioBufferProcessed(stream) {
|
||||||
|
numSamples := int32(0)
|
||||||
|
if samplesLeft >= 4096 {
|
||||||
|
numSamples = 4096
|
||||||
|
} else {
|
||||||
|
numSamples = samplesLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UpdateAudioStream(stream, unsafe.Pointer(&data[totalSamples-samplesLeft]), numSamples)
|
||||||
|
|
||||||
|
samplesLeft -= numSamples
|
||||||
|
|
||||||
|
// Reset samples feeding (loop audio)
|
||||||
|
if samplesLeft <= 0 {
|
||||||
|
samplesLeft = totalSamples
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
raylib.DrawText("SINE WAVE SHOULD BE PLAYING!", 240, 140, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
// NOTE: Draw a part of the sine wave (only screen width)
|
||||||
|
for i := 0; i < int(raylib.GetScreenWidth()); i++ {
|
||||||
|
position.X = float32(i)
|
||||||
|
position.Y = 250 + 50*data[i]
|
||||||
|
|
||||||
|
raylib.DrawPixelV(position, raylib.Red)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseAudioStream(stream) // Close raw audio stream and delete buffers from RAM
|
||||||
|
|
||||||
|
raylib.CloseAudioDevice() // Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
41
examples/audio/sound_loading/main.go
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [audio] example - sound loading and playing")
|
||||||
|
|
||||||
|
raylib.InitAudioDevice()
|
||||||
|
|
||||||
|
fxWav := raylib.LoadSound("weird.wav")
|
||||||
|
fxOgg := raylib.LoadSound("tanatana.ogg")
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if raylib.IsKeyPressed(raylib.KeySpace) {
|
||||||
|
raylib.PlaySound(fxWav)
|
||||||
|
}
|
||||||
|
if raylib.IsKeyPressed(raylib.KeyEnter) {
|
||||||
|
raylib.PlaySound(fxOgg)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, raylib.LightGray)
|
||||||
|
raylib.DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadSound(fxWav)
|
||||||
|
raylib.UnloadSound(fxOgg)
|
||||||
|
|
||||||
|
raylib.CloseAudioDevice()
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
BIN
examples/audio/sound_loading/tanatana.ogg
Normal file
BIN
examples/audio/sound_loading/weird.wav
Normal file
127
examples/core/2d_camera/main.go
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
MaxBuildings int = 100
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera")
|
||||||
|
|
||||||
|
player := raylib.NewRectangle(400, 280, 40, 40)
|
||||||
|
|
||||||
|
buildings := make([]raylib.Rectangle, MaxBuildings)
|
||||||
|
buildColors := make([]raylib.Color, MaxBuildings)
|
||||||
|
|
||||||
|
spacing := int32(0)
|
||||||
|
|
||||||
|
for i := 0; i < MaxBuildings; i++ {
|
||||||
|
r := raylib.Rectangle{}
|
||||||
|
r.Width = raylib.GetRandomValue(50, 200)
|
||||||
|
r.Height = raylib.GetRandomValue(100, 800)
|
||||||
|
r.Y = screenHeight - 130 - r.Height
|
||||||
|
r.X = -6000 + spacing
|
||||||
|
|
||||||
|
spacing += r.Width
|
||||||
|
|
||||||
|
c := raylib.NewColor(byte(raylib.GetRandomValue(200, 240)), byte(raylib.GetRandomValue(200, 240)), byte(raylib.GetRandomValue(200, 250)), byte(255))
|
||||||
|
|
||||||
|
buildings[i] = r
|
||||||
|
buildColors[i] = c
|
||||||
|
}
|
||||||
|
|
||||||
|
camera := raylib.Camera2D{}
|
||||||
|
camera.Target = raylib.NewVector2(float32(player.X+20), float32(player.Y+20))
|
||||||
|
camera.Offset = raylib.NewVector2(0, 0)
|
||||||
|
camera.Rotation = 0.0
|
||||||
|
camera.Zoom = 1.0
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(30)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if raylib.IsKeyDown(raylib.KeyRight) {
|
||||||
|
player.X += 2 // Player movement
|
||||||
|
camera.Offset.X -= 2 // Camera displacement with player movement
|
||||||
|
} else if raylib.IsKeyDown(raylib.KeyLeft) {
|
||||||
|
player.X -= 2 // Player movement
|
||||||
|
camera.Offset.X += 2 // Camera displacement with player movement
|
||||||
|
}
|
||||||
|
|
||||||
|
// Camera target follows player
|
||||||
|
camera.Target = raylib.NewVector2(float32(player.X+20), float32(player.Y+20))
|
||||||
|
|
||||||
|
// Camera rotation controls
|
||||||
|
if raylib.IsKeyDown(raylib.KeyA) {
|
||||||
|
camera.Rotation--
|
||||||
|
} else if raylib.IsKeyDown(raylib.KeyS) {
|
||||||
|
camera.Rotation++
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit camera rotation to 80 degrees (-40 to 40)
|
||||||
|
if camera.Rotation > 40 {
|
||||||
|
camera.Rotation = 40
|
||||||
|
} else if camera.Rotation < -40 {
|
||||||
|
camera.Rotation = -40
|
||||||
|
}
|
||||||
|
|
||||||
|
// Camera zoom controls
|
||||||
|
camera.Zoom += float32(raylib.GetMouseWheelMove()) * 0.05
|
||||||
|
|
||||||
|
if camera.Zoom > 3.0 {
|
||||||
|
camera.Zoom = 3.0
|
||||||
|
} else if camera.Zoom < 0.1 {
|
||||||
|
camera.Zoom = 0.1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Camera reset (zoom and rotation)
|
||||||
|
if raylib.IsKeyPressed(raylib.KeyR) {
|
||||||
|
camera.Zoom = 1.0
|
||||||
|
camera.Rotation = 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin2dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(-6000, 320, 13000, 8000, raylib.DarkGray)
|
||||||
|
|
||||||
|
for i := 0; i < MaxBuildings; i++ {
|
||||||
|
raylib.DrawRectangleRec(buildings[i], buildColors[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawRectangleRec(player, raylib.Red)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(int32(camera.Target.X), -500, 1, screenHeight*4, raylib.Green)
|
||||||
|
raylib.DrawRectangle(-500, int32(camera.Target.Y), screenWidth*4, 1, raylib.Green)
|
||||||
|
|
||||||
|
raylib.End2dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("SCREEN AREA", 640, 10, 20, raylib.Red)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(0, 0, screenWidth, 5, raylib.Red)
|
||||||
|
raylib.DrawRectangle(0, 5, 5, screenHeight-10, raylib.Red)
|
||||||
|
raylib.DrawRectangle(screenWidth-5, 5, 5, screenHeight-10, raylib.Red)
|
||||||
|
raylib.DrawRectangle(0, screenHeight-5, screenWidth, 5, raylib.Red)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(10, 10, 250, 113, raylib.Fade(raylib.SkyBlue, 0.5))
|
||||||
|
raylib.DrawRectangleLines(10, 10, 250, 113, raylib.Blue)
|
||||||
|
|
||||||
|
raylib.DrawText("Free 2d camera controls:", 20, 20, 10, raylib.Black)
|
||||||
|
raylib.DrawText("- Right/Left to move Offset", 40, 40, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- A / S to Rotate", 40, 80, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- R to reset Zoom and Rotation", 40, 100, 10, raylib.DarkGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
68
examples/core/3d_camera_first_person/main.go
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MaxColumns = 20
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - 3d camera first person")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(4.0, 2.0, 4.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 1.8, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 60.0
|
||||||
|
|
||||||
|
// Generates some random columns
|
||||||
|
heights := make([]float32, MaxColumns)
|
||||||
|
positions := make([]raylib.Vector3, MaxColumns)
|
||||||
|
colors := make([]raylib.Color, MaxColumns)
|
||||||
|
|
||||||
|
for i := 0; i < MaxColumns; i++ {
|
||||||
|
heights[i] = float32(raylib.GetRandomValue(1, 12))
|
||||||
|
positions[i] = raylib.NewVector3(float32(raylib.GetRandomValue(-15, 15)), heights[i]/2, float32(raylib.GetRandomValue(-15, 15)))
|
||||||
|
colors[i] = raylib.NewColor(uint8(raylib.GetRandomValue(20, 255)), uint8(raylib.GetRandomValue(10, 55)), 30, 255)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraFirstPerson) // Set a first person camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawPlane(raylib.NewVector3(0.0, 0.0, 0.0), raylib.NewVector2(32.0, 32.0), raylib.LightGray) // Draw ground
|
||||||
|
raylib.DrawCube(raylib.NewVector3(-16.0, 2.5, 0.0), 1.0, 5.0, 32.0, raylib.Blue) // Draw a blue wall
|
||||||
|
raylib.DrawCube(raylib.NewVector3(16.0, 2.5, 0.0), 1.0, 5.0, 32.0, raylib.Lime) // Draw a green wall
|
||||||
|
raylib.DrawCube(raylib.NewVector3(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, raylib.Gold) // Draw a yellow wall
|
||||||
|
|
||||||
|
// Draw some cubes around
|
||||||
|
for i := 0; i < MaxColumns; i++ {
|
||||||
|
raylib.DrawCube(positions[i], 2.0, heights[i], 2.0, colors[i])
|
||||||
|
raylib.DrawCubeWires(positions[i], 2.0, heights[i], 2.0, raylib.Maroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawRectangle(10, 10, 220, 70, raylib.Fade(raylib.SkyBlue, 0.5))
|
||||||
|
raylib.DrawRectangleLines(10, 10, 220, 70, raylib.Blue)
|
||||||
|
|
||||||
|
raylib.DrawText("First person camera default controls:", 20, 20, 10, raylib.Black)
|
||||||
|
raylib.DrawText("- Move with keys: W, A, S, D", 40, 40, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- Mouse move to look around", 40, 60, 10, raylib.DarkGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
56
examples/core/3d_camera_free/main.go
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - 3d camera free")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(10.0, 10.0, 10.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
cubePosition := raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraFree) // Set a free camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
if raylib.IsKeyDown(raylib.KeyZ) {
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawCube(cubePosition, 2.0, 2.0, 2.0, raylib.Red)
|
||||||
|
raylib.DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawRectangle(10, 10, 320, 133, raylib.Fade(raylib.SkyBlue, 0.5))
|
||||||
|
raylib.DrawRectangleLines(10, 10, 320, 133, raylib.Blue)
|
||||||
|
|
||||||
|
raylib.DrawText("Free camera default controls:", 20, 20, 10, raylib.Black)
|
||||||
|
raylib.DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, raylib.DarkGray)
|
||||||
|
raylib.DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, raylib.DarkGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
42
examples/core/3d_mode/main.go
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - 3d mode")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(5.0, 10.0, 10.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
cubePosition := raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawCube(cubePosition, 2.0, 2.0, 2.0, raylib.Red)
|
||||||
|
raylib.DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("Welcome to the third dimension!", 10, 40, 20, raylib.DarkGray)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
77
examples/core/3d_picking/main.go
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(10.0, 10.0, 10.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
cubePosition := raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
cubeSize := raylib.NewVector3(2.0, 2.0, 2.0)
|
||||||
|
|
||||||
|
var ray raylib.Ray
|
||||||
|
|
||||||
|
collision := false
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraFree) // Set a free camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
if raylib.IsMouseButtonPressed(raylib.MouseLeftButton) {
|
||||||
|
// NOTE: This function is NOT WORKING properly!
|
||||||
|
ray = raylib.GetMouseRay(raylib.GetMousePosition(), camera)
|
||||||
|
|
||||||
|
// Check collision between ray and box
|
||||||
|
min := raylib.NewVector3(cubePosition.X-cubeSize.X/2, cubePosition.Y-cubeSize.Y/2, cubePosition.Z-cubeSize.Z/2)
|
||||||
|
max := raylib.NewVector3(cubePosition.X+cubeSize.X/2, cubePosition.Y+cubeSize.Y/2, cubePosition.Z+cubeSize.Z/2)
|
||||||
|
collision = raylib.CheckCollisionRayBox(ray, raylib.NewBoundingBox(min, max))
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
if collision {
|
||||||
|
raylib.DrawCube(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, raylib.Red)
|
||||||
|
raylib.DrawCubeWires(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawCubeWires(cubePosition, cubeSize.X+0.2, cubeSize.Y+0.2, cubeSize.Z+0.2, raylib.Green)
|
||||||
|
} else {
|
||||||
|
raylib.DrawCube(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, raylib.Gray)
|
||||||
|
raylib.DrawCubeWires(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, raylib.DarkGray)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawRay(ray, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("Try selecting the box with mouse!", 240, 10, 20, raylib.DarkGray)
|
||||||
|
|
||||||
|
if collision {
|
||||||
|
raylib.DrawText("BOX SELECTED", (screenWidth-raylib.MeasureText("BOX SELECTED", 30))/2, int32(float32(screenHeight)*0.1), 30, raylib.Green)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
22
examples/core/basic_window/main.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "github.com/gen2brain/raylib-go/raylib"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.SetConfigFlags(raylib.FlagVsyncHint)
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - basic window")
|
||||||
|
|
||||||
|
//raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("Congrats! You created your first window!", 190, 200, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
70
examples/core/color_select/main.go
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - color selection (collision detection)")
|
||||||
|
|
||||||
|
colors := [21]raylib.Color{
|
||||||
|
raylib.DarkGray, raylib.Maroon, raylib.Orange, raylib.DarkGreen, raylib.DarkBlue, raylib.DarkPurple,
|
||||||
|
raylib.DarkBrown, raylib.Gray, raylib.Red, raylib.Gold, raylib.Lime, raylib.Blue, raylib.Violet, raylib.Brown,
|
||||||
|
raylib.LightGray, raylib.Pink, raylib.Yellow, raylib.Green, raylib.SkyBlue, raylib.Purple, raylib.Beige,
|
||||||
|
}
|
||||||
|
|
||||||
|
colorsRecs := make([]raylib.Rectangle, 21) // Rectangles array
|
||||||
|
|
||||||
|
// Fills colorsRecs data (for every rectangle)
|
||||||
|
for i := 0; i < 21; i++ {
|
||||||
|
r := raylib.Rectangle{}
|
||||||
|
r.X = int32(20 + 100*(i%7) + 10*(i%7))
|
||||||
|
r.Y = int32(60 + 100*(i/7) + 10*(i/7))
|
||||||
|
r.Width = 100
|
||||||
|
r.Height = 100
|
||||||
|
|
||||||
|
colorsRecs[i] = r
|
||||||
|
}
|
||||||
|
|
||||||
|
selected := make([]bool, 21) // Selected rectangles indicator
|
||||||
|
|
||||||
|
mousePoint := raylib.Vector2{}
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
mousePoint = raylib.GetMousePosition()
|
||||||
|
|
||||||
|
for i := 0; i < 21; i++ { // Iterate along all the rectangles
|
||||||
|
if raylib.CheckCollisionPointRec(mousePoint, colorsRecs[i]) {
|
||||||
|
colors[i].A = 120
|
||||||
|
|
||||||
|
if raylib.IsMouseButtonPressed(raylib.MouseLeftButton) {
|
||||||
|
selected[i] = !selected[i]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
colors[i].A = 255
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
for i := 0; i < 21; i++ { // Draw all rectangles
|
||||||
|
raylib.DrawRectangleRec(colorsRecs[i], colors[i])
|
||||||
|
|
||||||
|
// Draw four rectangles around selected rectangle
|
||||||
|
if selected[i] {
|
||||||
|
raylib.DrawRectangle(colorsRecs[i].X, colorsRecs[i].Y, 100, 10, raylib.RayWhite) // Square top rectangle
|
||||||
|
raylib.DrawRectangle(colorsRecs[i].X, colorsRecs[i].Y, 10, 100, raylib.RayWhite) // Square left rectangle
|
||||||
|
raylib.DrawRectangle(colorsRecs[i].X+90, colorsRecs[i].Y, 10, 100, raylib.RayWhite) // Square right rectangle
|
||||||
|
raylib.DrawRectangle(colorsRecs[i].X, colorsRecs[i].Y+90, 100, 10, raylib.RayWhite) // Square bottom rectangle
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
50
examples/core/drop_files/main.go
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files")
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
count := int32(0)
|
||||||
|
var droppedFiles []string
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if raylib.IsFileDropped() {
|
||||||
|
droppedFiles = raylib.GetDroppedFiles(&count)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
if count == 0 {
|
||||||
|
raylib.DrawText("Drop your files to this window!", 100, 40, 20, raylib.DarkGray)
|
||||||
|
} else {
|
||||||
|
raylib.DrawText("Dropped files:", 100, 40, 20, raylib.DarkGray)
|
||||||
|
|
||||||
|
for i := int32(0); i < count; i++ {
|
||||||
|
if i%2 == 0 {
|
||||||
|
raylib.DrawRectangle(0, int32(85+40*i), screenWidth, 40, raylib.Fade(raylib.LightGray, 0.5))
|
||||||
|
} else {
|
||||||
|
raylib.DrawRectangle(0, int32(85+40*i), screenWidth, 40, raylib.Fade(raylib.LightGray, 0.3))
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawText(droppedFiles[i], 120, int32(100), 10, raylib.Gray)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawText("Drop new files...", 100, int32(150), 20, raylib.DarkGray)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.ClearDroppedFiles()
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
99
examples/core/gestures_detection/main.go
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
MaxGestureStrings int = 20
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - gestures detection")
|
||||||
|
|
||||||
|
touchPosition := raylib.NewVector2(0, 0)
|
||||||
|
touchArea := raylib.NewRectangle(220, 10, screenWidth-230, screenHeight-20)
|
||||||
|
|
||||||
|
gestureStrings := make([]string, 0)
|
||||||
|
|
||||||
|
currentGesture := raylib.GestureNone
|
||||||
|
lastGesture := raylib.GestureNone
|
||||||
|
|
||||||
|
//raylib.SetGesturesEnabled(uint32(raylib.GestureHold | raylib.GestureDrag)) // Enable only some gestures to be detected
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
lastGesture = currentGesture
|
||||||
|
currentGesture = raylib.GetGestureDetected()
|
||||||
|
touchPosition = raylib.GetTouchPosition(0)
|
||||||
|
|
||||||
|
if raylib.CheckCollisionPointRec(touchPosition, touchArea) && currentGesture != raylib.GestureNone {
|
||||||
|
if currentGesture != lastGesture {
|
||||||
|
switch currentGesture {
|
||||||
|
case raylib.GestureTap:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE TAP")
|
||||||
|
case raylib.GestureDoubletap:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE DOUBLETAP")
|
||||||
|
case raylib.GestureHold:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE HOLD")
|
||||||
|
case raylib.GestureDrag:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE DRAG")
|
||||||
|
case raylib.GestureSwipeRight:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE SWIPE RIGHT")
|
||||||
|
case raylib.GestureSwipeLeft:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE SWIPE LEFT")
|
||||||
|
case raylib.GestureSwipeUp:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE SWIPE UP")
|
||||||
|
case raylib.GestureSwipeDown:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE SWIPE DOWN")
|
||||||
|
case raylib.GesturePinchIn:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE PINCH IN")
|
||||||
|
case raylib.GesturePinchOut:
|
||||||
|
gestureStrings = append(gestureStrings, "GESTURE PINCH OUT")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(gestureStrings) >= MaxGestureStrings {
|
||||||
|
gestureStrings = make([]string, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawRectangleRec(touchArea, raylib.Gray)
|
||||||
|
raylib.DrawRectangle(225, 15, screenWidth-240, screenHeight-30, raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("GESTURES TEST AREA", screenWidth-270, screenHeight-40, 20, raylib.Fade(raylib.Gray, 0.5))
|
||||||
|
|
||||||
|
for i := 0; i < len(gestureStrings); i++ {
|
||||||
|
if i%2 == 0 {
|
||||||
|
raylib.DrawRectangle(10, int32(30+20*i), 200, 20, raylib.Fade(raylib.LightGray, 0.5))
|
||||||
|
} else {
|
||||||
|
raylib.DrawRectangle(10, int32(30+20*i), 200, 20, raylib.Fade(raylib.LightGray, 0.3))
|
||||||
|
}
|
||||||
|
|
||||||
|
if i < len(gestureStrings)-1 {
|
||||||
|
raylib.DrawText(gestureStrings[i], 35, int32(36+20*i), 10, raylib.DarkGray)
|
||||||
|
} else {
|
||||||
|
raylib.DrawText(gestureStrings[i], 35, int32(36+20*i), 10, raylib.Maroon)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawRectangleLines(10, 29, 200, screenHeight-50, raylib.Gray)
|
||||||
|
raylib.DrawText("DETECTED GESTURES", 50, 15, 10, raylib.Gray)
|
||||||
|
|
||||||
|
if currentGesture != raylib.GestureNone {
|
||||||
|
raylib.DrawCircleV(touchPosition, 30, raylib.Maroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
201
examples/core/input_gamepad/main.go
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
Xbox360NameId = "Xbox 360 Controller"
|
||||||
|
Ps3NameId = "PLAYSTATION(R)3 Controller"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.SetConfigFlags(raylib.FlagMsaa4xHint) // Set MSAA 4X hint before windows creation
|
||||||
|
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - gamepad input")
|
||||||
|
|
||||||
|
texPs3Pad := raylib.LoadTexture("ps3.png")
|
||||||
|
texXboxPad := raylib.LoadTexture("xbox.png")
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
if raylib.IsGamepadAvailable(raylib.GamepadPlayer1) {
|
||||||
|
raylib.DrawText(fmt.Sprintf("GP1: %s", raylib.GetGamepadName(raylib.GamepadPlayer1)), 10, 10, 10, raylib.Black)
|
||||||
|
|
||||||
|
if raylib.IsGamepadName(raylib.GamepadPlayer1, Xbox360NameId) {
|
||||||
|
raylib.DrawTexture(texXboxPad, 0, 0, raylib.DarkGray)
|
||||||
|
|
||||||
|
// Draw buttons: xbox home
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonHome) {
|
||||||
|
raylib.DrawCircle(394, 89, 19, raylib.Red)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw buttons: basic
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonStart) {
|
||||||
|
raylib.DrawCircle(436, 150, 9, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonSelect) {
|
||||||
|
raylib.DrawCircle(352, 150, 9, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonX) {
|
||||||
|
raylib.DrawCircle(501, 151, 15, raylib.Blue)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonA) {
|
||||||
|
raylib.DrawCircle(536, 187, 15, raylib.Lime)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonB) {
|
||||||
|
raylib.DrawCircle(572, 151, 15, raylib.Maroon)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonY) {
|
||||||
|
raylib.DrawCircle(536, 115, 15, raylib.Gold)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw buttons: d-pad
|
||||||
|
raylib.DrawRectangle(317, 202, 19, 71, raylib.Black)
|
||||||
|
raylib.DrawRectangle(293, 228, 69, 19, raylib.Black)
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonUp) {
|
||||||
|
raylib.DrawRectangle(317, 202, 19, 26, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonDown) {
|
||||||
|
raylib.DrawRectangle(317, 202+45, 19, 26, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonLeft) {
|
||||||
|
raylib.DrawRectangle(292, 228, 25, 19, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonRight) {
|
||||||
|
raylib.DrawRectangle(292+44, 228, 26, 19, raylib.Red)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw buttons: left-right back
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonLb) {
|
||||||
|
raylib.DrawCircle(259, 61, 20, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadXboxButtonRb) {
|
||||||
|
raylib.DrawCircle(536, 61, 20, raylib.Red)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw axis: left joystick
|
||||||
|
raylib.DrawCircle(259, 152, 39, raylib.Black)
|
||||||
|
raylib.DrawCircle(259, 152, 34, raylib.LightGray)
|
||||||
|
raylib.DrawCircle(int32(259+(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisLeftX)*20)),
|
||||||
|
int32(152-(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisLeftY)*20)), 25, raylib.Black)
|
||||||
|
|
||||||
|
// Draw axis: right joystick
|
||||||
|
raylib.DrawCircle(461, 237, 38, raylib.Black)
|
||||||
|
raylib.DrawCircle(461, 237, 33, raylib.LightGray)
|
||||||
|
raylib.DrawCircle(int32(461+(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisRightX)*20)),
|
||||||
|
int32(237-(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisRightY)*20)), 25, raylib.Black)
|
||||||
|
|
||||||
|
// Draw axis: left-right triggers
|
||||||
|
raylib.DrawRectangle(170, 30, 15, 70, raylib.Gray)
|
||||||
|
raylib.DrawRectangle(604, 30, 15, 70, raylib.Gray)
|
||||||
|
raylib.DrawRectangle(170, 30, 15, int32(((1.0+raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisLt))/2.0)*70), raylib.Red)
|
||||||
|
raylib.DrawRectangle(604, 30, 15, int32(((1.0+raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadXboxAxisRt))/2.0)*70), raylib.Red)
|
||||||
|
|
||||||
|
} else if raylib.IsGamepadName(raylib.GamepadPlayer1, Ps3NameId) {
|
||||||
|
raylib.DrawTexture(texPs3Pad, 0, 0, raylib.DarkGray)
|
||||||
|
|
||||||
|
// Draw buttons: ps
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonPs) {
|
||||||
|
raylib.DrawCircle(396, 222, 13, raylib.Red)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw buttons: basic
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonSelect) {
|
||||||
|
raylib.DrawRectangle(328, 170, 32, 13, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonStart) {
|
||||||
|
raylib.DrawTriangle(raylib.NewVector2(436, 168), raylib.NewVector2(436, 185), raylib.NewVector2(464, 177), raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonTriangle) {
|
||||||
|
raylib.DrawCircle(557, 144, 13, raylib.Lime)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonCircle) {
|
||||||
|
raylib.DrawCircle(586, 173, 13, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonCross) {
|
||||||
|
raylib.DrawCircle(557, 203, 13, raylib.Violet)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonSquare) {
|
||||||
|
raylib.DrawCircle(527, 173, 13, raylib.Pink)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw buttons: d-pad
|
||||||
|
raylib.DrawRectangle(225, 132, 24, 84, raylib.Black)
|
||||||
|
raylib.DrawRectangle(195, 161, 84, 25, raylib.Black)
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonUp) {
|
||||||
|
raylib.DrawRectangle(225, 132, 24, 29, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonDown) {
|
||||||
|
raylib.DrawRectangle(225, 132+54, 24, 30, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonLeft) {
|
||||||
|
raylib.DrawRectangle(195, 161, 30, 25, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonRight) {
|
||||||
|
raylib.DrawRectangle(195+54, 161, 30, 25, raylib.Red)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw buttons: left-right back buttons
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonL1) {
|
||||||
|
raylib.DrawCircle(239, 82, 20, raylib.Red)
|
||||||
|
}
|
||||||
|
if raylib.IsGamepadButtonDown(raylib.GamepadPlayer1, raylib.GamepadPs3ButtonR1) {
|
||||||
|
raylib.DrawCircle(557, 82, 20, raylib.Red)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw axis: left joystick
|
||||||
|
raylib.DrawCircle(319, 255, 35, raylib.Black)
|
||||||
|
raylib.DrawCircle(319, 255, 31, raylib.LightGray)
|
||||||
|
raylib.DrawCircle(int32(319+(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadPs3AxisLeftX)*20)),
|
||||||
|
int32(255+(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadPs3AxisLeftY)*20)), 25, raylib.Black)
|
||||||
|
|
||||||
|
// Draw axis: right joystick
|
||||||
|
raylib.DrawCircle(475, 255, 35, raylib.Black)
|
||||||
|
raylib.DrawCircle(475, 255, 31, raylib.LightGray)
|
||||||
|
raylib.DrawCircle(int32(475+(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadPs3AxisRightX)*20)),
|
||||||
|
int32(255+(raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadPs3AxisRightY)*20)), 25, raylib.Black)
|
||||||
|
|
||||||
|
// Draw axis: left-right triggers
|
||||||
|
raylib.DrawRectangle(169, 48, 15, 70, raylib.Gray)
|
||||||
|
raylib.DrawRectangle(611, 48, 15, 70, raylib.Gray)
|
||||||
|
raylib.DrawRectangle(169, 48, 15, int32(((1.0-raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadPs3AxisL2))/2.0)*70), raylib.Red)
|
||||||
|
raylib.DrawRectangle(611, 48, 15, int32(((1.0-raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, raylib.GamepadPs3AxisR2))/2.0)*70), raylib.Red)
|
||||||
|
} else {
|
||||||
|
raylib.DrawText("- GENERIC GAMEPAD -", 280, 180, 20, raylib.Gray)
|
||||||
|
|
||||||
|
// TODO: Draw generic gamepad
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawText(fmt.Sprintf("DETECTED AXIS [%d]:", raylib.GetGamepadAxisCount(raylib.GamepadPlayer1)), 10, 50, 10, raylib.Maroon)
|
||||||
|
|
||||||
|
for i := int32(0); i < raylib.GetGamepadAxisCount(raylib.GamepadPlayer1); i++ {
|
||||||
|
raylib.DrawText(fmt.Sprintf("AXIS %d: %.02f", i, raylib.GetGamepadAxisMovement(raylib.GamepadPlayer1, i)), 20, 70+20*i, 10, raylib.DarkGray)
|
||||||
|
}
|
||||||
|
|
||||||
|
if raylib.GetGamepadButtonPressed() != -1 {
|
||||||
|
raylib.DrawText(fmt.Sprintf("DETECTED BUTTON: %d", raylib.GetGamepadButtonPressed()), 10, 430, 10, raylib.Red)
|
||||||
|
} else {
|
||||||
|
raylib.DrawText("DETECTED BUTTON: NONE", 10, 430, 10, raylib.Gray)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
raylib.DrawText("GP1: NOT DETECTED", 10, 10, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawTexture(texXboxPad, 0, 0, raylib.LightGray)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadTexture(texPs3Pad)
|
||||||
|
raylib.UnloadTexture(texXboxPad)
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
BIN
examples/core/input_gamepad/ps3.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
examples/core/input_gamepad/xbox.png
Normal file
After Width: | Height: | Size: 16 KiB |
41
examples/core/input_keys/main.go
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input")
|
||||||
|
|
||||||
|
ballPosition := raylib.NewVector2(float32(screenWidth)/2, float32(screenHeight)/2)
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if raylib.IsKeyDown(raylib.KeyRight) {
|
||||||
|
ballPosition.X += 0.8
|
||||||
|
}
|
||||||
|
if raylib.IsKeyDown(raylib.KeyLeft) {
|
||||||
|
ballPosition.X -= 0.8
|
||||||
|
}
|
||||||
|
if raylib.IsKeyDown(raylib.KeyUp) {
|
||||||
|
ballPosition.Y -= 0.8
|
||||||
|
}
|
||||||
|
if raylib.IsKeyDown(raylib.KeyDown) {
|
||||||
|
ballPosition.Y += 0.8
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("move the ball with arrow keys", 10, 10, 20, raylib.DarkGray)
|
||||||
|
raylib.DrawCircleV(ballPosition, 50, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
35
examples/core/input_mouse/main.go
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - mouse input")
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
ballColor := raylib.DarkBlue
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
ballPosition := raylib.GetMousePosition()
|
||||||
|
|
||||||
|
if raylib.IsMouseButtonPressed(raylib.MouseLeftButton) {
|
||||||
|
ballColor = raylib.Maroon
|
||||||
|
} else if raylib.IsMouseButtonPressed(raylib.MouseMiddleButton) {
|
||||||
|
ballColor = raylib.Lime
|
||||||
|
} else if raylib.IsMouseButtonPressed(raylib.MouseRightButton) {
|
||||||
|
ballColor = raylib.DarkBlue
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
raylib.DrawCircleV(ballPosition, 40, ballColor)
|
||||||
|
|
||||||
|
raylib.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, raylib.DarkGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
40
examples/core/mouse_wheel/main.go
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
MaxBuildings int = 100
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel")
|
||||||
|
|
||||||
|
boxPositionY := screenHeight/2 - 40
|
||||||
|
scrollSpeed := int32(4) // Scrolling speed in pixels
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
boxPositionY -= raylib.GetMouseWheelMove() * scrollSpeed
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(screenWidth/2-40, boxPositionY, 80, 80, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, raylib.Gray)
|
||||||
|
raylib.DrawText(fmt.Sprintf("Box position Y: %d", boxPositionY), 10, 40, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
62
examples/core/oculus_rift/main.go
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(1080)
|
||||||
|
screenHeight := int32(600)
|
||||||
|
|
||||||
|
// NOTE: screenWidth/screenHeight should match VR device aspect ratio
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift")
|
||||||
|
|
||||||
|
// NOTE: If device is not available, it fallbacks to default device (simulator)
|
||||||
|
raylib.InitVrDevice(raylib.HmdOculusRiftCv1) // Init VR device (Oculus Rift CV1)
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(5.0, 2.0, 5.0) // Camera position
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 2.0, 0.0) // Camera looking at point
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0) // Camera up vector (rotation towards target)
|
||||||
|
camera.Fovy = 60.0 // Camera field-of-view Y
|
||||||
|
|
||||||
|
cubePosition := raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraFirstPerson) // Set first person camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(90)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if raylib.IsVrSimulator() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera (simulator mode)
|
||||||
|
} else if raylib.IsVrDeviceReady() {
|
||||||
|
raylib.UpdateVrTracking(&camera) // Update camera with device tracking data
|
||||||
|
}
|
||||||
|
|
||||||
|
if raylib.IsKeyPressed(raylib.KeySpace) {
|
||||||
|
raylib.ToggleVrMode() // Toggle VR mode
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawCube(cubePosition, 2.0, 2.0, 2.0, raylib.Red)
|
||||||
|
raylib.DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawGrid(40, 1.0)
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseVrDevice() // Close VR device
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
38
examples/core/random_values/main.go
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - generate random values")
|
||||||
|
|
||||||
|
framesCounter := 0 // Variable used to count frames
|
||||||
|
randValue := raylib.GetRandomValue(-8, 5) // Get a random integer number between -8 and 5 (both included)
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
framesCounter++
|
||||||
|
|
||||||
|
// Every two seconds (120 frames) a new random value is generated
|
||||||
|
if ((framesCounter / 120) % 2) == 1 {
|
||||||
|
randValue = raylib.GetRandomValue(-8, 5)
|
||||||
|
framesCounter = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawText(fmt.Sprintf("%d", randValue), 360, 180, 80, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
58
examples/core/storage_values/main.go
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
StorageScore = 0
|
||||||
|
StorageHiscore = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [core] example - storage save/load values")
|
||||||
|
|
||||||
|
score := int32(0)
|
||||||
|
hiscore := int32(0)
|
||||||
|
|
||||||
|
framesCounter := 0
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if raylib.IsKeyPressed(raylib.KeyR) {
|
||||||
|
score = raylib.GetRandomValue(1000, 2000)
|
||||||
|
hiscore = raylib.GetRandomValue(2000, 4000)
|
||||||
|
}
|
||||||
|
|
||||||
|
if raylib.IsKeyPressed(raylib.KeyEnter) {
|
||||||
|
raylib.StorageSaveValue(StorageScore, score)
|
||||||
|
raylib.StorageSaveValue(StorageHiscore, hiscore)
|
||||||
|
} else if raylib.IsKeyPressed(raylib.KeySpace) {
|
||||||
|
// NOTE: If requested position could not be found, value 0 is returned
|
||||||
|
score = raylib.StorageLoadValue(StorageScore)
|
||||||
|
hiscore = raylib.StorageLoadValue(StorageHiscore)
|
||||||
|
}
|
||||||
|
|
||||||
|
framesCounter++
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText(fmt.Sprintf("SCORE: %d", score), 280, 130, 40, raylib.Maroon)
|
||||||
|
raylib.DrawText(fmt.Sprintf("HI-SCORE: %d", hiscore), 210, 200, 50, raylib.Black)
|
||||||
|
|
||||||
|
raylib.DrawText(fmt.Sprintf("frames: %d", framesCounter), 10, 10, 20, raylib.Lime)
|
||||||
|
|
||||||
|
raylib.DrawText("Press R to generate random numbers", 220, 40, 20, raylib.LightGray)
|
||||||
|
raylib.DrawText("Press ENTER to SAVE values", 250, 310, 20, raylib.LightGray)
|
||||||
|
raylib.DrawText("Press SPACE to LOAD values", 252, 350, 20, raylib.LightGray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
52
examples/core/world_screen/main.go
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(10.0, 10.0, 10.0) // Camera position
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0) // Camera looking at point
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0) // Camera up vector (rotation towards target)
|
||||||
|
camera.Fovy = 45.0 // Camera field-of-view Y
|
||||||
|
|
||||||
|
cubePosition := raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
cubeScreenPosition := raylib.Vector2{}
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraFree) // Set a free camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
// Calculate cube screen space position (with a little offset to be in top)
|
||||||
|
cubeScreenPosition = raylib.GetWorldToScreen(raylib.NewVector3(cubePosition.X, cubePosition.Y+2.5, cubePosition.Z), camera)
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawCube(cubePosition, 2.0, 2.0, 2.0, raylib.Red)
|
||||||
|
raylib.DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0)
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("Enemy: 100 / 100", int32(cubeScreenPosition.X)-raylib.MeasureText("Enemy: 100 / 100", 20)/2, int32(cubeScreenPosition.Y), 20, raylib.Black)
|
||||||
|
raylib.DrawText("Text is always on top of the cube", (screenWidth-raylib.MeasureText("Text is always on top of the cube", 20))/2, 25, 20, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
88
examples/easings/easings/main.go
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/easings"
|
||||||
|
"github.com/gen2brain/raylib-go/raygui"
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagVsyncHint)
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [easings] example - easings")
|
||||||
|
|
||||||
|
currentTime := 0
|
||||||
|
duration := float32(60)
|
||||||
|
startPositionX := float32(screenWidth) / 4
|
||||||
|
finalPositionX := startPositionX * 3
|
||||||
|
currentPositionX := startPositionX
|
||||||
|
|
||||||
|
ballPosition := raylib.NewVector2(startPositionX, float32(screenHeight)/2)
|
||||||
|
|
||||||
|
comboActive := 0
|
||||||
|
comboLastActive := 0
|
||||||
|
|
||||||
|
easingTypes := []string{"SineIn", "SineOut", "SineInOut", "BounceIn", "BounceOut", "BounceInOut", "BackIn", "BackOut", "BackInOut"}
|
||||||
|
ease := easingTypes[comboActive]
|
||||||
|
|
||||||
|
//raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if raylib.IsKeyDown(raylib.KeyR) {
|
||||||
|
currentTime = 0
|
||||||
|
currentPositionX = startPositionX
|
||||||
|
ballPosition.X = currentPositionX
|
||||||
|
}
|
||||||
|
|
||||||
|
if comboLastActive != comboActive {
|
||||||
|
currentTime = 0
|
||||||
|
currentPositionX = startPositionX
|
||||||
|
ballPosition.X = currentPositionX
|
||||||
|
|
||||||
|
ease = easingTypes[comboActive]
|
||||||
|
comboLastActive = comboActive
|
||||||
|
}
|
||||||
|
|
||||||
|
if currentPositionX < finalPositionX {
|
||||||
|
switch ease {
|
||||||
|
case "SineIn":
|
||||||
|
currentPositionX = easings.SineIn(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "SineOut":
|
||||||
|
currentPositionX = easings.SineOut(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "SineInOut":
|
||||||
|
currentPositionX = easings.SineInOut(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "BounceIn":
|
||||||
|
currentPositionX = easings.BounceIn(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "BounceOut":
|
||||||
|
currentPositionX = easings.BounceOut(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "BounceInOut":
|
||||||
|
currentPositionX = easings.BounceInOut(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "BackIn":
|
||||||
|
currentPositionX = easings.BackIn(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "BackOut":
|
||||||
|
currentPositionX = easings.BackOut(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
case "BackInOut":
|
||||||
|
currentPositionX = easings.BackInOut(float32(currentTime), startPositionX, finalPositionX-startPositionX, duration)
|
||||||
|
}
|
||||||
|
|
||||||
|
ballPosition.X = currentPositionX
|
||||||
|
currentTime++
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(20, 20, 200, 20), "Easing Type:")
|
||||||
|
comboActive = raygui.ComboBox(raylib.NewRectangle(20, 40, 200, 20), easingTypes, comboActive)
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(20, 80, 200, 20), "Press R to reset")
|
||||||
|
|
||||||
|
raylib.DrawCircleV(ballPosition, 50, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
91
examples/gui/basic_controls/main.go
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raygui"
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagVsyncHint)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [gui] example - basic controls")
|
||||||
|
|
||||||
|
buttonToggle := true
|
||||||
|
buttonClicked := false
|
||||||
|
checkboxChecked := false
|
||||||
|
|
||||||
|
spinnerValue := 5
|
||||||
|
sliderValue := float32(10)
|
||||||
|
sliderBarValue := float32(70)
|
||||||
|
progressValue := float32(0.5)
|
||||||
|
|
||||||
|
comboActive := 0
|
||||||
|
comboLastActive := 0
|
||||||
|
toggleActive := 0
|
||||||
|
|
||||||
|
toggleText := []string{"Item 1", "Item 2", "Item 3"}
|
||||||
|
comboText := []string{"default_light", "default_dark", "hello_kitty", "monokai", "obsidian", "solarized_light", "solarized", "zahnrad"}
|
||||||
|
|
||||||
|
var inputText string
|
||||||
|
|
||||||
|
//raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if buttonClicked {
|
||||||
|
progressValue += 0.1
|
||||||
|
if progressValue >= 1.1 {
|
||||||
|
progressValue = 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.Beige)
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(50, 50, 80, 20), "Label")
|
||||||
|
|
||||||
|
buttonClicked = raygui.Button(raylib.NewRectangle(50, 70, 80, 40), "Button")
|
||||||
|
|
||||||
|
checkboxChecked = raygui.CheckBox(raylib.NewRectangle(50, 140, 20, 20), " CheckBox", checkboxChecked)
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(50, 190, 200, 20), "ProgressBar")
|
||||||
|
raygui.ProgressBar(raylib.NewRectangle(50, 210, 200, 20), progressValue)
|
||||||
|
raygui.Label(raylib.NewRectangle(200+50+5, 210, 20, 20), fmt.Sprintf("%.1f", progressValue))
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(50, 260, 200, 20), "Slider")
|
||||||
|
sliderValue = raygui.Slider(raylib.NewRectangle(50, 280, 200, 20), sliderValue, 0, 100)
|
||||||
|
raygui.Label(raylib.NewRectangle(200+50+5, 280, 20, 20), fmt.Sprintf("%.0f", sliderValue))
|
||||||
|
|
||||||
|
buttonToggle = raygui.ToggleButton(raylib.NewRectangle(50, 350, 100, 40), "ToggleButton", buttonToggle)
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(500, 50, 200, 20), "ToggleGroup")
|
||||||
|
toggleActive = raygui.ToggleGroup(raylib.NewRectangle(500, 70, 60, 30), toggleText, toggleActive)
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(500, 120, 200, 20), "SliderBar")
|
||||||
|
sliderBarValue = raygui.SliderBar(raylib.NewRectangle(500, 140, 200, 20), sliderBarValue, 0, 100)
|
||||||
|
raygui.Label(raylib.NewRectangle(500+200+5, 140, 20, 20), fmt.Sprintf("%.0f", sliderBarValue))
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(500, 190, 200, 20), "Spinner")
|
||||||
|
spinnerValue = raygui.Spinner(raylib.NewRectangle(500, 210, 200, 20), spinnerValue, 0, 100)
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(500, 260, 200, 20), "ComboBox")
|
||||||
|
comboActive = raygui.ComboBox(raylib.NewRectangle(500, 280, 200, 20), comboText, comboActive)
|
||||||
|
|
||||||
|
if comboLastActive != comboActive {
|
||||||
|
raygui.LoadGuiStyle(fmt.Sprintf("styles/%s.style", comboText[comboActive]))
|
||||||
|
comboLastActive = comboActive
|
||||||
|
}
|
||||||
|
|
||||||
|
raygui.Label(raylib.NewRectangle(500, 330, 200, 20), "TextBox")
|
||||||
|
inputText = raygui.TextBox(raylib.NewRectangle(500, 350, 200, 20), inputText)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
99
examples/gui/basic_controls/styles/default_dark.style
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
GLOBAL_BASE_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_BORDER_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_TEXT_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0x293235ff
|
||||||
|
LINES_COLOR 0x90abb5ff
|
||||||
|
LABEL_BORDER_WIDTH 0x0
|
||||||
|
LABEL_TEXT_COLOR 0x90acb4ff
|
||||||
|
LABEL_TEXT_PADDING 0x0
|
||||||
|
BUTTON_BORDER_WIDTH 0x2
|
||||||
|
BUTTON_TEXT_PADDING 0x0
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x3e4a4fff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0x344041ff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0x90acb4ff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0x47595fff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0x334f59ff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0x90acb4ff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x5f9aa4ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0x334f59ff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x20
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x3e4b4dff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0x344041ff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0x828282ff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0x47595fff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0x334f59ff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0x828282ff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0x5f9aa8ff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0x334f59ff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0x92c763ff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0x334f59ff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0x92c763ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x0
|
||||||
|
SLIDER_BORDER_COLOR 0x828282ff
|
||||||
|
SLIDER_INSIDE_COLOR 0x3e4b4dff
|
||||||
|
SLIDER_DEFAULT_COLOR 0x92c763ff
|
||||||
|
SLIDER_HOVER_COLOR 0xc3e0a9ff
|
||||||
|
SLIDER_ACTIVE_COLOR 0xffffffff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x828282ff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0x344041ff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0x92c763ff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0xc3e0a9ff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0xffffffff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0x828282ff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x828282ff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0x3e4b4dff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0x92c763ff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x1
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x3e4b4dff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0x344041ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x3e4b4dff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x344041ff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0x5f9aa8ff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0x47595fff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x334f59ff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0x5f9aa8ff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x92c763ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x334f59ff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0x92c763ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0x92c763ff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x30
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x20
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x3e4b4dff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0x344041ff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0x47595fff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0x334f59ff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x5f9aa8ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0x334f59ff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0x5f9aa8ff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x92c763ff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x334f59ff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0x92c763ff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x47595fff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0x344041ff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0x47595fff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0x334f59ff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x5f9aa8ff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0x334f59ff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0x92c763ff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x2
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x47595fff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0x828282ff
|
||||||
|
TEXTBOX_TEXT_COLOR 0xff
|
||||||
|
TEXTBOX_LINE_COLOR 0xff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0xa
|
99
examples/gui/basic_controls/styles/default_light.style
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
GLOBAL_BASE_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_BORDER_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_TEXT_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0xf5f5f5ff
|
||||||
|
LINES_COLOR 0x90abb5ff
|
||||||
|
LABEL_BORDER_WIDTH 0x1
|
||||||
|
LABEL_TEXT_COLOR 0x4d4d4dff
|
||||||
|
LABEL_TEXT_PADDING 0x14
|
||||||
|
BUTTON_BORDER_WIDTH 0x2
|
||||||
|
BUTTON_TEXT_PADDING 0x14
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0x4d4d4dff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0x868686ff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0xbcecffff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0x5f9aa7ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x14
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0x828282ff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0x828282ff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0xbdd7eaff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0xddf5ffff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0xafccd3ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0xbcecffff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0x5f9aa7ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BORDER_COLOR 0x828282ff
|
||||||
|
SLIDER_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
SLIDER_DEFAULT_COLOR 0xbcecffff
|
||||||
|
SLIDER_HOVER_COLOR 0xffffffff
|
||||||
|
SLIDER_ACTIVE_COLOR 0xddf5ffff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x828282ff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0xbcecffff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0xffffffff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0xddf5ffff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0x828282ff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x828282ff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0xbcecffff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x2
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x828282ff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x828282ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0xff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0xff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0xffffffff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0xff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0xff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0xbcecffff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0x5f9aa7ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0xff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x1e
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x14
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0xc8c8c8ff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0x828282ff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x828282ff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0x828282ff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0x828282ff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0xbcecffff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0x5f9aa7ff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x78acff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x66e7ffff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0x78acff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0xffffffff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x66e7ffff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0xddf5ffff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0xbcecffff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x828282ff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0xf5f5f5ff
|
||||||
|
TEXTBOX_TEXT_COLOR 0xff
|
||||||
|
TEXTBOX_LINE_COLOR 0xff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0xa
|
98
examples/gui/basic_controls/styles/hello_kitty.style
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
GLOBAL_BASE_COLOR 0xff80c1ff
|
||||||
|
GLOBAL_BORDER_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_TEXT_COLOR 0x650065ff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0xffd4eaff
|
||||||
|
LABEL_BORDER_WIDTH 0x1
|
||||||
|
LABEL_TEXT_COLOR 0x650065ff
|
||||||
|
LABEL_TEXT_PADDING 0x14
|
||||||
|
BUTTON_BORDER_WIDTH 0x2
|
||||||
|
BUTTON_TEXT_PADDING 0x14
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0x650065ff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0x761c76ff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0xffb8dcff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0xa971a9ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x14
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0x650065ff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0x761c76ff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0xbdd7eaff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0xffb8dcff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0xa971a9ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0xff8ec7ff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0xa971a9ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BORDER_COLOR 0x828282ff
|
||||||
|
SLIDER_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
SLIDER_DEFAULT_COLOR 0xffaad5ff
|
||||||
|
SLIDER_HOVER_COLOR 0xff9cceff
|
||||||
|
SLIDER_ACTIVE_COLOR 0xff80c1ff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x828282ff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0xffaad5ff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0xff9cceff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0xff80c1ff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0xff8ec7ff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x828282ff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0xffaad5ff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x2
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x828282ff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x828282ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0x650065ff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0x650065ff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0x761c76ff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0x761c76ff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0xffb8dcff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0xa971a9ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0xa971a9ff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x1e
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x1e
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0x650065ff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x650065ff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0x761c76ff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0x761c76ff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x7bb0d6ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0xff8ec7ff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0xba8dbaff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x78acff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0xff8ec7ff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xba8dbaff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x828282ff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0xc8c8c8ff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x66e7ffff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0xffaad5ff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0xff8ec7ff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x4
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x828282ff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0xffc6e3ff
|
||||||
|
TEXTBOX_TEXT_COLOR 0x650065ff
|
||||||
|
TEXTBOX_LINE_COLOR 0x985598ff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0xa
|
98
examples/gui/basic_controls/styles/monokai.style
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
GLOBAL_BASE_COLOR 0x262921ff
|
||||||
|
GLOBAL_BORDER_COLOR 0x102ff
|
||||||
|
GLOBAL_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0xb6b7b5ff
|
||||||
|
LABEL_BORDER_WIDTH 0x1
|
||||||
|
LABEL_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
LABEL_TEXT_PADDING 0x14
|
||||||
|
BUTTON_BORDER_WIDTH 0x2
|
||||||
|
BUTTON_TEXT_PADDING 0x14
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0x868883ff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x14
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0x868883ff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0x3e4039ff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDER_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
SLIDER_DEFAULT_COLOR 0x6e706bff
|
||||||
|
SLIDER_HOVER_COLOR 0x565852ff
|
||||||
|
SLIDER_ACTIVE_COLOR 0x262921ff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0x6e706bff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0x565852ff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0x262921ff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0x3e4039ff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x38393aff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0x6e706bff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x2
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0xf8f8f1ff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0xf8f8f2ff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x868883ff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0xfbfbf7ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x1e
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x1e
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0x3e4039ff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0xfbfbf8ff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x3e4039ff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xfbfbf8ff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x102ff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0x6e706bff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0x3e4039ff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x4
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x38393aff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0x9e9f9cff
|
||||||
|
TEXTBOX_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
TEXTBOX_LINE_COLOR 0xfafaf5ff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0xa
|
98
examples/gui/basic_controls/styles/obsidian.style
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
GLOBAL_BASE_COLOR 0x293034ff
|
||||||
|
GLOBAL_BORDER_COLOR 0x102ff
|
||||||
|
GLOBAL_TEXT_COLOR 0xa8e2aeff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0xb7babbff
|
||||||
|
LABEL_BORDER_WIDTH 0x1
|
||||||
|
LABEL_TEXT_COLOR 0xa8e2aeff
|
||||||
|
LABEL_TEXT_PADDING 0x14
|
||||||
|
BUTTON_BORDER_WIDTH 0x2
|
||||||
|
BUTTON_TEXT_PADDING 0x14
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0xa8e2aeff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0xb1e5b7ff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0x888c8eff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0xceeed2ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x14
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0xa8e2aeff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0xb1e5b7ff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0x888c8eff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0xceeed2ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0x40474aff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0xceeed2ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDER_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
SLIDER_DEFAULT_COLOR 0x707577ff
|
||||||
|
SLIDER_HOVER_COLOR 0x585e61ff
|
||||||
|
SLIDER_ACTIVE_COLOR 0x293034ff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0x707577ff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0x585e61ff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0x293034ff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0x40474aff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x38393aff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0x707577ff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x2
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0xa8e2aeff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0xa8e2aeff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0xb1e5b7ff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0xb1e5b7ff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x888c8eff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0xceeed2ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0xceeed2ff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x1e
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x1e
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0xa8e2aeff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xa8e2aeff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0xb1e5b7ff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0xb1e5b7ff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0x40474aff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0xd8f2dbff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x40474aff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xd8f2dbff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x102ff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0x707577ff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0x40474aff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x4
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x38393aff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0x9fa3a4ff
|
||||||
|
TEXTBOX_TEXT_COLOR 0xa8e2aeff
|
||||||
|
TEXTBOX_LINE_COLOR 0xc5ebc9ff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0xa
|
98
examples/gui/basic_controls/styles/solarized.style
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
GLOBAL_BASE_COLOR 0x2b36ff
|
||||||
|
GLOBAL_BORDER_COLOR 0x102ff
|
||||||
|
GLOBAL_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0xaab8bcff
|
||||||
|
LABEL_BORDER_WIDTH 0x1
|
||||||
|
LABEL_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
LABEL_TEXT_PADDING 0x14
|
||||||
|
BUTTON_BORDER_WIDTH 0x2
|
||||||
|
BUTTON_TEXT_PADDING 0x14
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0x71898fff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x14
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0x71898fff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0x1c424cff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDER_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
SLIDER_DEFAULT_COLOR 0x557179ff
|
||||||
|
SLIDER_HOVER_COLOR 0x385a62ff
|
||||||
|
SLIDER_ACTIVE_COLOR 0x2b36ff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0x557179ff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0x385a62ff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0x2b36ff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0x1c424cff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x38393aff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0x557179ff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x2
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0xf8f8f1ff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0xf8f8f2ff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x71898fff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0xfbfbf7ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0xfbfbf7ff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x1e
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x1e
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0xf8f8f2ff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0x1c424cff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0xfbfbf8ff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x1c424cff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xfbfbf8ff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x102ff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0x557179ff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0x1c424cff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x4
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x38393aff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0x8da0a5ff
|
||||||
|
TEXTBOX_TEXT_COLOR 0xf8f8f1ff
|
||||||
|
TEXTBOX_LINE_COLOR 0xfafaf5ff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0xa
|
98
examples/gui/basic_controls/styles/solarized_light.style
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
GLOBAL_BASE_COLOR 0xfcf6e3ff
|
||||||
|
GLOBAL_BORDER_COLOR 0x102ff
|
||||||
|
GLOBAL_TEXT_COLOR 0x657b82ff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0xfefcf5ff
|
||||||
|
LABEL_BORDER_WIDTH 0x1
|
||||||
|
LABEL_TEXT_COLOR 0x657b82ff
|
||||||
|
LABEL_TEXT_PADDING 0x14
|
||||||
|
BUTTON_BORDER_WIDTH 0x2
|
||||||
|
BUTTON_TEXT_PADDING 0x14
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0x657b82ff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0x76898fff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0xfdfaefff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0xa9b5b9ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x14
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0x657b82ff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0x76898fff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0xfdfaefff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0xa9b5b9ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0x102ff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0xfcf7e6ff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0xa9b5b9ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x1
|
||||||
|
SLIDER_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDER_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
SLIDER_DEFAULT_COLOR 0xfdf9ecff
|
||||||
|
SLIDER_HOVER_COLOR 0xfcf8e9ff
|
||||||
|
SLIDER_ACTIVE_COLOR 0xfcf6e3ff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x38393aff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0xfdf9ecff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0xfcf8e9ff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0xfcf6e3ff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0xfcf7e6ff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x38393aff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0xfdf9ecff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x2
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x38393aff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0x657b82ff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0x657b82ff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0x1c1d1eff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0x76898fff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0x76898fff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x102ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0xfdfaefff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0xa9b5b9ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0xa9b5b9ff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x1e
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x1e
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0x657b82ff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0x657b82ff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0x76898fff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0x76898fff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0xfcf7e6ff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0xbac4c7ff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x102ff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0xfcf7e6ff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0xbac4c7ff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x38393aff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0x1c1d1eff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0xffffffff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x102ff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0xfdf9ecff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0xfcf7e6ff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x4
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x38393aff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0xfdfbf2ff
|
||||||
|
TEXTBOX_TEXT_COLOR 0x657b82ff
|
||||||
|
TEXTBOX_LINE_COLOR 0x98a7abff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0xa
|
98
examples/gui/basic_controls/styles/zahnrad.style
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
GLOBAL_BASE_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_BORDER_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_TEXT_COLOR 0xf5f5f5ff
|
||||||
|
GLOBAL_TEXT_FONTSIZE 0xa
|
||||||
|
GLOBAL_BORDER_WIDTH 0x1
|
||||||
|
BACKGROUND_COLOR 0x2d2d2dff
|
||||||
|
LABEL_BORDER_WIDTH 0x2
|
||||||
|
LABEL_TEXT_COLOR 0xafafafff
|
||||||
|
LABEL_TEXT_PADDING 0x14
|
||||||
|
BUTTON_BORDER_WIDTH 0x1
|
||||||
|
BUTTON_TEXT_PADDING 0x14
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR 0x414141ff
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR 0x323232ff
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR 0xafafafff
|
||||||
|
BUTTON_HOVER_BORDER_COLOR 0x3e3e3eff
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR 0x2d2d2dff
|
||||||
|
BUTTON_HOVER_TEXT_COLOR 0x767472ff
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR 0x414141ff
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR 0x323232ff
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR 0x616161ff
|
||||||
|
TOGGLE_TEXT_PADDING 0x14
|
||||||
|
TOGGLE_BORDER_WIDTH 0x1
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR 0x414141ff
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR 0x323232ff
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR 0xafafafff
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR 0x3e3e3eff
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR 0x2d2d2dff
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR 0x767472ff
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR 0x414141ff
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR 0x323232ff
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR 0x616161ff
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR 0xafafafff
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR 0x414141ff
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR 0xa3a3a3ff
|
||||||
|
TOGGLEGROUP_PADDING 0x3
|
||||||
|
SLIDER_BORDER_WIDTH 0x0
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH 0x0
|
||||||
|
SLIDER_BORDER_COLOR 0x414141ff
|
||||||
|
SLIDER_INSIDE_COLOR 0x232525ff
|
||||||
|
SLIDER_DEFAULT_COLOR 0x646464ff
|
||||||
|
SLIDER_HOVER_COLOR 0x767472ff
|
||||||
|
SLIDER_ACTIVE_COLOR 0x929291ff
|
||||||
|
SLIDERBAR_BORDER_COLOR 0x828282ff
|
||||||
|
SLIDERBAR_INSIDE_COLOR 0x262626ff
|
||||||
|
SLIDERBAR_DEFAULT_COLOR 0x616161ff
|
||||||
|
SLIDERBAR_HOVER_COLOR 0x646464ff
|
||||||
|
SLIDERBAR_ACTIVE_COLOR 0x929292ff
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR 0xafafafff
|
||||||
|
PROGRESSBAR_BORDER_COLOR 0x828282ff
|
||||||
|
PROGRESSBAR_INSIDE_COLOR 0x262626ff
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR 0x646464ff
|
||||||
|
PROGRESSBAR_BORDER_WIDTH 0x0
|
||||||
|
SPINNER_LABEL_BORDER_COLOR 0x414141ff
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR 0x323232ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR 0x414141ff
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR 0x323232ff
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR 0xafafafff
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR 0xafafafff
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR 0x3e3e3eff
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR 0x2d2d2dff
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR 0x767472ff
|
||||||
|
SPINNER_HOVER_TEXT_COLOR 0x767472ff
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR 0x414141ff
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR 0x323232ff
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR 0x646464ff
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR 0x646464ff
|
||||||
|
COMBOBOX_PADDING 0x1
|
||||||
|
COMBOBOX_BUTTON_WIDTH 0x1e
|
||||||
|
COMBOBOX_BUTTON_HEIGHT 0x1e
|
||||||
|
COMBOBOX_BORDER_WIDTH 0x1
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR 0x414141ff
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR 0x323232ff
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR 0xafafafff
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR 0xafafafff
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR 0x3e3e3eff
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR 0x2d2d2dff
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR 0x767472ff
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR 0x767472ff
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR 0x414141ff
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR 0x323232ff
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR 0x646464ff
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR 0x414141ff
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR 0x323232ff
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR 0x646464ff
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR 0x414141ff
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR 0x323232ff
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR 0x3e3e3eff
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR 0x2d2d2dff
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR 0x414141ff
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR 0x323232ff
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR 0x414141ff
|
||||||
|
CHECKBOX_INSIDE_WIDTH 0x2
|
||||||
|
TEXTBOX_BORDER_WIDTH 0x1
|
||||||
|
TEXTBOX_BORDER_COLOR 0x414141ff
|
||||||
|
TEXTBOX_INSIDE_COLOR 0x323232ff
|
||||||
|
TEXTBOX_TEXT_COLOR 0xafafafff
|
||||||
|
TEXTBOX_LINE_COLOR 0xafafafff
|
||||||
|
TEXTBOX_TEXT_FONTSIZE 0x9
|
BIN
examples/models/billboard/billboard.png
Normal file
After Width: | Height: | Size: 22 KiB |
47
examples/models/billboard/main.go
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(5.0, 4.0, 5.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 2.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
bill := raylib.LoadTexture("billboard.png") // Our texture billboard
|
||||||
|
billPosition := raylib.NewVector3(0.0, 2.0, 0.0) // Position where draw billboard
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraOrbital) // Set an orbital camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawBillboard(camera, bill, billPosition, 2.0, raylib.White)
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadTexture(bill) // Unload texture
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
109
examples/models/box_collisions/main.go
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(10.0, 10.0, 10.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
playerPosition := raylib.NewVector3(0.0, 1.0, 2.0)
|
||||||
|
playerSize := raylib.NewVector3(1.0, 2.0, 1.0)
|
||||||
|
playerColor := raylib.Green
|
||||||
|
|
||||||
|
enemyBoxPos := raylib.NewVector3(-4.0, 1.0, 0.0)
|
||||||
|
enemyBoxSize := raylib.NewVector3(2.0, 2.0, 2.0)
|
||||||
|
|
||||||
|
enemySpherePos := raylib.NewVector3(4.0, 0.0, 0.0)
|
||||||
|
enemySphereSize := float32(1.5)
|
||||||
|
|
||||||
|
collision := false
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
// Update
|
||||||
|
|
||||||
|
// Move player
|
||||||
|
if raylib.IsKeyDown(raylib.KeyRight) {
|
||||||
|
playerPosition.X += 0.2
|
||||||
|
} else if raylib.IsKeyDown(raylib.KeyLeft) {
|
||||||
|
playerPosition.X -= 0.2
|
||||||
|
} else if raylib.IsKeyDown(raylib.KeyDown) {
|
||||||
|
playerPosition.Z += 0.2
|
||||||
|
} else if raylib.IsKeyDown(raylib.KeyUp) {
|
||||||
|
playerPosition.Z -= 0.2
|
||||||
|
}
|
||||||
|
|
||||||
|
collision = false
|
||||||
|
|
||||||
|
// Check collisions player vs enemy-box
|
||||||
|
if raylib.CheckCollisionBoxes(
|
||||||
|
raylib.NewBoundingBox(
|
||||||
|
raylib.NewVector3(playerPosition.X-playerSize.X/2, playerPosition.Y-playerSize.Y/2, playerPosition.Z-playerSize.Z/2),
|
||||||
|
raylib.NewVector3(playerPosition.X+playerSize.X/2, playerPosition.Y+playerSize.Y/2, playerPosition.Z+playerSize.Z/2)),
|
||||||
|
raylib.NewBoundingBox(
|
||||||
|
raylib.NewVector3(enemyBoxPos.X-enemyBoxSize.X/2, enemyBoxPos.Y-enemyBoxSize.Y/2, enemyBoxPos.Z-enemyBoxSize.Z/2),
|
||||||
|
raylib.NewVector3(enemyBoxPos.X+enemyBoxSize.X/2, enemyBoxPos.Y+enemyBoxSize.Y/2, enemyBoxPos.Z+enemyBoxSize.Z/2)),
|
||||||
|
) {
|
||||||
|
collision = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check collisions player vs enemy-sphere
|
||||||
|
if raylib.CheckCollisionBoxSphere(
|
||||||
|
raylib.NewBoundingBox(
|
||||||
|
raylib.NewVector3(playerPosition.X-playerSize.X/2, playerPosition.Y-playerSize.Y/2, playerPosition.Z-playerSize.Z/2),
|
||||||
|
raylib.NewVector3(playerPosition.X+playerSize.X/2, playerPosition.Y+playerSize.Y/2, playerPosition.Z+playerSize.Z/2)),
|
||||||
|
enemySpherePos,
|
||||||
|
enemySphereSize,
|
||||||
|
) {
|
||||||
|
collision = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if collision {
|
||||||
|
playerColor = raylib.Red
|
||||||
|
} else {
|
||||||
|
playerColor = raylib.Green
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
// Draw enemy-box
|
||||||
|
raylib.DrawCube(enemyBoxPos, enemyBoxSize.X, enemyBoxSize.Y, enemyBoxSize.Z, raylib.Gray)
|
||||||
|
raylib.DrawCubeWires(enemyBoxPos, enemyBoxSize.X, enemyBoxSize.Y, enemyBoxSize.Z, raylib.DarkGray)
|
||||||
|
|
||||||
|
// Draw enemy-sphere
|
||||||
|
raylib.DrawSphere(enemySpherePos, enemySphereSize, raylib.Gray)
|
||||||
|
raylib.DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, raylib.DarkGray)
|
||||||
|
|
||||||
|
// Draw player
|
||||||
|
raylib.DrawCubeV(playerPosition, playerSize, playerColor)
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("Move player with cursors to collide", 220, 40, 20, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
BIN
examples/models/cubicmap/cubicmap.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
examples/models/cubicmap/cubicmap_atlas.png
Normal file
After Width: | Height: | Size: 36 KiB |
68
examples/models/cubicmap/main.go
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(16.0, 14.0, 16.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
image := raylib.LoadImage("cubicmap.png") // Load cubicmap image (RAM)
|
||||||
|
cubic := raylib.LoadTextureFromImage(image) // Convert image to texture to display (VRAM)
|
||||||
|
cubicmap := raylib.LoadCubicmap(image) // Load cubicmap model (generate model from image)
|
||||||
|
|
||||||
|
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||||
|
texture := raylib.LoadTexture("cubicmap_atlas.png") // Load map texture
|
||||||
|
cubicmap.Material.TexDiffuse = texture // Set map diffuse texture
|
||||||
|
|
||||||
|
mapPosition := raylib.NewVector3(-16.0, 0.0, -8.0) // Set model position
|
||||||
|
|
||||||
|
raylib.UnloadImage(image) // Unload cubesmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraOrbital) // Set an orbital camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
// Update
|
||||||
|
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawModel(cubicmap, mapPosition, 1.0, raylib.White)
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawTextureEx(cubic, raylib.NewVector2(float32(screenWidth-cubic.Width*4-20), 20), 0.0, 4.0, raylib.White)
|
||||||
|
raylib.DrawRectangleLines(screenWidth-cubic.Width*4-20, 20, cubic.Width*4, cubic.Height*4, raylib.Green)
|
||||||
|
|
||||||
|
raylib.DrawText("cubicmap image used to", 658, 90, 10, raylib.Gray)
|
||||||
|
raylib.DrawText("generate map 3d model", 658, 104, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadTexture(cubic) // Unload cubicmap texture
|
||||||
|
raylib.UnloadTexture(texture) // Unload map texture
|
||||||
|
raylib.UnloadModel(cubicmap) // Unload map model
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
52
examples/models/geometric_shapes/main.go
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(0.1, 10.0, 10.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawCube(raylib.NewVector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, raylib.Red)
|
||||||
|
raylib.DrawCubeWires(raylib.NewVector3(-4.0, 0.0, 2.0), 2.0, 5.0, 2.0, raylib.Gold)
|
||||||
|
raylib.DrawCubeWires(raylib.NewVector3(-4.0, 0.0, -2.0), 3.0, 6.0, 2.0, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.DrawSphere(raylib.NewVector3(-1.0, 0.0, -2.0), 1.0, raylib.Green)
|
||||||
|
raylib.DrawSphereWires(raylib.NewVector3(1.0, 0.0, 2.0), 2.0, 16, 16, raylib.Lime)
|
||||||
|
|
||||||
|
raylib.DrawCylinder(raylib.NewVector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, raylib.SkyBlue)
|
||||||
|
raylib.DrawCylinderWires(raylib.NewVector3(4.0, 0.0, -2.0), 1.0, 2.0, 3.0, 4, raylib.DarkBlue)
|
||||||
|
raylib.DrawCylinderWires(raylib.NewVector3(4.5, -1.0, 2.0), 1.0, 1.0, 2.0, 6, raylib.Brown)
|
||||||
|
|
||||||
|
raylib.DrawCylinder(raylib.NewVector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, raylib.Gold)
|
||||||
|
raylib.DrawCylinderWires(raylib.NewVector3(1.0, 0.0, -4.0), 0.0, 1.5, 3.0, 8, raylib.Pink)
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
BIN
examples/models/heightmap/heightmap.png
Normal file
After Width: | Height: | Size: 11 KiB |
63
examples/models/heightmap/main.go
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(18.0, 16.0, 18.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
image := raylib.LoadImage("heightmap.png") // Load heightmap image (RAM)
|
||||||
|
texture := raylib.LoadTextureFromImage(image) // Convert image to texture (VRAM)
|
||||||
|
hmap := raylib.LoadHeightmap(image, raylib.NewVector3(16, 8, 16)) // Load heightmap model with defined size
|
||||||
|
hmap.Material.TexDiffuse = texture // Set map diffuse texture
|
||||||
|
mapPosition := raylib.NewVector3(-8.0, 0.0, -8.0) // Set model position
|
||||||
|
|
||||||
|
raylib.UnloadImage(image) // Unload cubesmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraOrbital) // Set an orbital camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
// Update
|
||||||
|
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
// NOTE: Model is scaled to 1/4 of its original size (128x128 units)
|
||||||
|
raylib.DrawModel(hmap, mapPosition, 1.0, raylib.Red)
|
||||||
|
|
||||||
|
raylib.DrawGrid(20, 1.0)
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawTexture(texture, screenWidth-texture.Width-20, 20, raylib.White)
|
||||||
|
raylib.DrawRectangleLines(screenWidth-texture.Width-20, 20, texture.Width, texture.Height, raylib.Green)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadTexture(texture) // Unload map texture
|
||||||
|
raylib.UnloadModel(hmap) // Unload map model
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
54966
examples/models/obj_loading/dwarf.obj
Normal file
BIN
examples/models/obj_loading/dwarf_diffuse.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
52
examples/models/obj_loading/main.go
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(3.0, 3.0, 3.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 1.5, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
dwarf := raylib.LoadModel("dwarf.obj") // Load OBJ model
|
||||||
|
texture := raylib.LoadTexture("dwarf_diffuse.png") // Load model texture
|
||||||
|
|
||||||
|
dwarf.Material.TexDiffuse = texture // Set dwarf model diffuse texture
|
||||||
|
|
||||||
|
position := raylib.NewVector3(0.0, 0.0, 0.0) // Set model position
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.DrawGizmo(position) // Draw gizmo
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("(c) Dwarf 3D model by David Moreno", screenWidth-200, screenHeight-20, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadTexture(texture) // Unload texture
|
||||||
|
raylib.UnloadModel(dwarf) // Unload model
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
54966
examples/shaders/custom_uniform/dwarf.obj
Normal file
BIN
examples/shaders/custom_uniform/dwarf_diffuse.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
26
examples/shaders/custom_uniform/glsl330/base.vs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec3 vertexNormal;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform mat4 mvpMatrix;
|
||||||
|
|
||||||
|
// Output vertex attributes (to fragment shader)
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send vertex attributes to fragment shader
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
46
examples/shaders/custom_uniform/glsl330/swirl.fs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
const float renderWidth = 800.0; // HARDCODED for example!
|
||||||
|
const float renderHeight = 480.0; // Use uniforms instead...
|
||||||
|
|
||||||
|
float radius = 250.0;
|
||||||
|
float angle = 0.8;
|
||||||
|
|
||||||
|
uniform vec2 center = vec2(200.0, 200.0);
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec2 texSize = vec2(renderWidth, renderHeight);
|
||||||
|
vec2 tc = fragTexCoord*texSize;
|
||||||
|
tc -= center;
|
||||||
|
|
||||||
|
float dist = length(tc);
|
||||||
|
|
||||||
|
if (dist < radius)
|
||||||
|
{
|
||||||
|
float percent = (radius - dist)/radius;
|
||||||
|
float theta = percent*percent*angle*8.0;
|
||||||
|
float s = sin(theta);
|
||||||
|
float c = cos(theta);
|
||||||
|
|
||||||
|
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
|
||||||
|
}
|
||||||
|
|
||||||
|
tc += center;
|
||||||
|
vec4 color = texture2D(texture0, tc/texSize)*colDiffuse*fragColor;;
|
||||||
|
|
||||||
|
finalColor = vec4(color.rgb, 1.0);;
|
||||||
|
}
|
97
examples/shaders/custom_uniform/main.go
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagMsaa4xHint) // Enable Multi Sampling Anti Aliasing 4x (if available)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shaders] example - custom uniform variable")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(3.0, 3.0, 3.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 1.5, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
dwarf := raylib.LoadModel("dwarf.obj") // Load OBJ model
|
||||||
|
texture := raylib.LoadTexture("dwarf_diffuse.png") // Load model texture
|
||||||
|
|
||||||
|
dwarf.Material.TexDiffuse = texture // Bind texture to model
|
||||||
|
|
||||||
|
position := raylib.NewVector3(0.0, 0.0, 0.0) // Set model position
|
||||||
|
|
||||||
|
shader := raylib.LoadShader("glsl330/base.vs", "glsl330/swirl.fs") // Load postpro shader
|
||||||
|
|
||||||
|
// Get variable (uniform) location on the shader to connect with the program
|
||||||
|
// NOTE: If uniform variable could not be found in the shader, function returns -1
|
||||||
|
swirlCenterLoc := raylib.GetShaderLocation(shader, "center")
|
||||||
|
|
||||||
|
swirlCenter := make([]float32, 2)
|
||||||
|
swirlCenter[0] = float32(screenWidth) / 2
|
||||||
|
swirlCenter[1] = float32(screenHeight) / 2
|
||||||
|
|
||||||
|
// Create a RenderTexture2D to be used for render to texture
|
||||||
|
target := raylib.LoadRenderTexture(screenWidth, screenHeight)
|
||||||
|
|
||||||
|
// Setup orbital camera
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraOrbital) // Set an orbital camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
mousePosition := raylib.GetMousePosition()
|
||||||
|
|
||||||
|
swirlCenter[0] = mousePosition.X
|
||||||
|
swirlCenter[1] = float32(screenHeight) - mousePosition.Y
|
||||||
|
|
||||||
|
// Send new value to the shader to be used on drawing
|
||||||
|
raylib.SetShaderValue(shader, swirlCenterLoc, swirlCenter, 2)
|
||||||
|
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.BeginTextureMode(target) // Enable drawing to texture
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, raylib.Red)
|
||||||
|
|
||||||
|
raylib.EndTextureMode() // End drawing to texture (now we have a texture available for next passes)
|
||||||
|
|
||||||
|
raylib.BeginShaderMode(shader)
|
||||||
|
|
||||||
|
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||||
|
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, target.Texture.Width, -target.Texture.Height), raylib.NewVector2(0, 0), raylib.White)
|
||||||
|
|
||||||
|
raylib.EndShaderMode()
|
||||||
|
|
||||||
|
raylib.DrawText("(c) Dwarf 3D model by David Moreno", screenWidth-200, screenHeight-20, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadShader(shader) // Unload shader
|
||||||
|
raylib.UnloadTexture(texture) // Unload texture
|
||||||
|
raylib.UnloadModel(dwarf) // Unload model
|
||||||
|
raylib.UnloadRenderTexture(target) // Unload render texture
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
54966
examples/shaders/model_shader/dwarf.obj
Normal file
BIN
examples/shaders/model_shader/dwarf_diffuse.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
26
examples/shaders/model_shader/glsl330/base.vs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec3 vertexNormal;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform mat4 mvpMatrix;
|
||||||
|
|
||||||
|
// Output vertex attributes (to fragment shader)
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send vertex attributes to fragment shader
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
26
examples/shaders/model_shader/glsl330/grayscale.fs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Texel color fetching from texture sampler
|
||||||
|
vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor;
|
||||||
|
|
||||||
|
// Convert texel color to grayscale using NTSC conversion weights
|
||||||
|
float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));
|
||||||
|
|
||||||
|
// Calculate final fragment color
|
||||||
|
finalColor = vec4(gray, gray, gray, texelColor.a);
|
||||||
|
}
|
66
examples/shaders/model_shader/main.go
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagMsaa4xHint) // Enable Multi Sampling Anti Aliasing 4x (if available)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(3.0, 3.0, 3.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 1.5, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
dwarf := raylib.LoadModel("dwarf.obj") // Load OBJ model
|
||||||
|
texture := raylib.LoadTexture("dwarf_diffuse.png") // Load model texture
|
||||||
|
shader := raylib.LoadShader("glsl330/base.vs", "glsl330/grayscale.fs") // Load model shader
|
||||||
|
|
||||||
|
dwarf.Material.Shader = shader // Set shader effect to 3d model
|
||||||
|
dwarf.Material.TexDiffuse = texture // Bind texture to model
|
||||||
|
|
||||||
|
position := raylib.NewVector3(0.0, 0.0, 0.0) // Set model position
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraFree) // Set free camera mode
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("(c) Dwarf 3D model by David Moreno", screenWidth-200, screenHeight-20, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawText(fmt.Sprintf("Camera position: (%.2f, %.2f, %.2f)", camera.Position.X, camera.Position.Y, camera.Position.Z), 600, 20, 10, raylib.Black)
|
||||||
|
raylib.DrawText(fmt.Sprintf("Camera target: (%.2f, %.2f, %.2f)", camera.Target.X, camera.Target.Y, camera.Target.Z), 600, 40, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadShader(shader) // Unload shader
|
||||||
|
raylib.UnloadTexture(texture) // Unload texture
|
||||||
|
raylib.UnloadModel(dwarf) // Unload model
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
54966
examples/shaders/postprocessing/dwarf.obj
Normal file
BIN
examples/shaders/postprocessing/dwarf_diffuse.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
26
examples/shaders/postprocessing/glsl330/base.vs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec3 vertexNormal;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform mat4 mvpMatrix;
|
||||||
|
|
||||||
|
// Output vertex attributes (to fragment shader)
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send vertex attributes to fragment shader
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
40
examples/shaders/postprocessing/glsl330/bloom.fs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
const vec2 size = vec2(800, 450); // render size
|
||||||
|
const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance
|
||||||
|
const float quality = 2.5; // lower = smaller glow, better quality
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 sum = vec4(0);
|
||||||
|
vec2 sizeFactor = vec2(1)/size*quality;
|
||||||
|
|
||||||
|
// Texel color fetching from texture sampler
|
||||||
|
vec4 source = texture(texture0, fragTexCoord);
|
||||||
|
|
||||||
|
const int range = 2; // should be = (samples - 1)/2;
|
||||||
|
|
||||||
|
for (int x = -range; x <= range; x++)
|
||||||
|
{
|
||||||
|
for (int y = -range; y <= range; y++)
|
||||||
|
{
|
||||||
|
sum += texture(texture0, fragTexCoord + vec2(x, y)*sizeFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate final fragment color
|
||||||
|
finalColor = ((sum/(samples*samples)) + source)*colDiffuse;
|
||||||
|
}
|
77
examples/shaders/postprocessing/main.go
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagMsaa4xHint | raylib.FlagVsyncHint) // Enable Multi Sampling Anti Aliasing 4x (if available)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shaders] example - postprocessing shader")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(3.0, 3.0, 3.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 1.5, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
dwarf := raylib.LoadModel("dwarf.obj") // Load OBJ model
|
||||||
|
texture := raylib.LoadTexture("dwarf_diffuse.png") // Load model texture
|
||||||
|
dwarf.Material.TexDiffuse = texture // Set dwarf model diffuse texture
|
||||||
|
|
||||||
|
position := raylib.NewVector3(0.0, 0.0, 0.0) // Set model position
|
||||||
|
|
||||||
|
shader := raylib.LoadShader("glsl330/base.vs", "glsl330/bloom.fs") // Load postpro shader
|
||||||
|
|
||||||
|
// Create a RenderTexture2D to be used for render to texture
|
||||||
|
target := raylib.LoadRenderTexture(screenWidth, screenHeight)
|
||||||
|
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraOrbital) // Set free camera mode
|
||||||
|
|
||||||
|
//raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.BeginTextureMode(target) // Enable drawing to texture
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("HELLO POSTPROCESSING!", 70, 190, 50, raylib.Red)
|
||||||
|
|
||||||
|
raylib.EndTextureMode() // End drawing to texture (now we have a texture available for next passes)
|
||||||
|
|
||||||
|
raylib.BeginShaderMode(shader)
|
||||||
|
|
||||||
|
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||||
|
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, target.Texture.Width, -target.Texture.Height), raylib.NewVector2(0, 0), raylib.White)
|
||||||
|
|
||||||
|
raylib.EndShaderMode()
|
||||||
|
|
||||||
|
raylib.DrawText("(c) Dwarf 3D model by David Moreno", screenWidth-200, screenHeight-20, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadShader(shader) // Unload shader
|
||||||
|
raylib.UnloadTexture(texture) // Unload texture
|
||||||
|
raylib.UnloadModel(dwarf) // Unload model
|
||||||
|
raylib.UnloadRenderTexture(target) // Unload render texture
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
26
examples/shaders/shapes_textures/glsl330/base.vs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec2 vertexTexCoord;
|
||||||
|
in vec3 vertexNormal;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform mat4 mvpMatrix;
|
||||||
|
|
||||||
|
// Output vertex attributes (to fragment shader)
|
||||||
|
out vec2 fragTexCoord;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Send vertex attributes to fragment shader
|
||||||
|
fragTexCoord = vertexTexCoord;
|
||||||
|
fragColor = vertexColor;
|
||||||
|
|
||||||
|
// Calculate final vertex position
|
||||||
|
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||||
|
}
|
26
examples/shaders/shapes_textures/glsl330/grayscale.fs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
in vec4 fragColor;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
uniform vec4 colDiffuse;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// Texel color fetching from texture sampler
|
||||||
|
vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor;
|
||||||
|
|
||||||
|
// Convert texel color to grayscale using NTSC conversion weights
|
||||||
|
float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));
|
||||||
|
|
||||||
|
// Calculate final fragment color
|
||||||
|
finalColor = vec4(gray, gray, gray, texelColor.a);
|
||||||
|
}
|
72
examples/shaders/shapes_textures/main.go
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shapes and texture shaders")
|
||||||
|
|
||||||
|
sonic := raylib.LoadTexture("sonic.png")
|
||||||
|
|
||||||
|
// NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
|
||||||
|
shader := raylib.LoadShader("glsl330/base.vs", "glsl330/grayscale.fs")
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
// Start drawing with default shader
|
||||||
|
|
||||||
|
raylib.DrawText("USING DEFAULT SHADER", 20, 40, 10, raylib.Red)
|
||||||
|
|
||||||
|
raylib.DrawCircle(80, 120, 35, raylib.DarkBlue)
|
||||||
|
raylib.DrawCircleGradient(80, 220, 60, raylib.Green, raylib.SkyBlue)
|
||||||
|
raylib.DrawCircleLines(80, 340, 80, raylib.DarkBlue)
|
||||||
|
|
||||||
|
// Activate our custom shader to be applied on next shapes/textures drawings
|
||||||
|
raylib.BeginShaderMode(shader)
|
||||||
|
|
||||||
|
raylib.DrawText("USING CUSTOM SHADER", 190, 40, 10, raylib.Red)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(250-60, 90, 120, 60, raylib.Red)
|
||||||
|
raylib.DrawRectangleGradient(250-90, 170, 180, 130, raylib.Maroon, raylib.Gold)
|
||||||
|
raylib.DrawRectangleLines(250-40, 320, 80, 60, raylib.Orange)
|
||||||
|
|
||||||
|
// Activate our default shader for next drawings
|
||||||
|
raylib.EndShaderMode()
|
||||||
|
|
||||||
|
raylib.DrawText("USING DEFAULT SHADER", 370, 40, 10, raylib.Red)
|
||||||
|
|
||||||
|
raylib.DrawTriangle(raylib.NewVector2(430, 80),
|
||||||
|
raylib.NewVector2(430-60, 150),
|
||||||
|
raylib.NewVector2(430+60, 150), raylib.Violet)
|
||||||
|
|
||||||
|
raylib.DrawTriangleLines(raylib.NewVector2(430, 160),
|
||||||
|
raylib.NewVector2(430-20, 230),
|
||||||
|
raylib.NewVector2(430+20, 230), raylib.DarkBlue)
|
||||||
|
|
||||||
|
raylib.DrawPoly(raylib.NewVector2(430, 320), 6, 80, 0, raylib.Brown)
|
||||||
|
|
||||||
|
// Activate our custom shader to be applied on next shapes/textures drawings
|
||||||
|
raylib.BeginShaderMode(shader)
|
||||||
|
|
||||||
|
raylib.DrawTexture(sonic, 380, -10, raylib.White) // Using custom shader
|
||||||
|
|
||||||
|
// Activate our default shader for next drawings
|
||||||
|
raylib.EndShaderMode()
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadShader(shader) // Unload shader
|
||||||
|
raylib.UnloadTexture(sonic) // Unload texture
|
||||||
|
|
||||||
|
raylib.CloseWindow() // Close window and OpenGL context
|
||||||
|
}
|
BIN
examples/shaders/shapes_textures/sonic.png
Normal file
After Width: | Height: | Size: 114 KiB |
54966
examples/shaders/standard_lighting/dwarf.obj
Normal file
BIN
examples/shaders/standard_lighting/dwarf_diffuse.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
examples/shaders/standard_lighting/dwarf_normal.png
Normal file
After Width: | Height: | Size: 3.9 MiB |
BIN
examples/shaders/standard_lighting/dwarf_specular.png
Normal file
After Width: | Height: | Size: 2.8 MiB |
93
examples/shaders/standard_lighting/main.go
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.SetConfigFlags(raylib.FlagMsaa4xHint | raylib.FlagVsyncHint) // Enable Multi Sampling Anti Aliasing 4x (if available)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader")
|
||||||
|
|
||||||
|
camera := raylib.Camera{}
|
||||||
|
camera.Position = raylib.NewVector3(4.0, 4.0, 4.0)
|
||||||
|
camera.Target = raylib.NewVector3(0.0, 1.5, 0.0)
|
||||||
|
camera.Up = raylib.NewVector3(0.0, 1.0, 0.0)
|
||||||
|
camera.Fovy = 45.0
|
||||||
|
|
||||||
|
position := raylib.NewVector3(0.0, 0.0, 0.0) // Set model position
|
||||||
|
|
||||||
|
dwarf := raylib.LoadModel("dwarf.obj") // Load OBJ model
|
||||||
|
|
||||||
|
material := raylib.LoadStandardMaterial()
|
||||||
|
|
||||||
|
material.TexDiffuse = raylib.LoadTexture("dwarf_diffuse.png") // Load model diffuse texture
|
||||||
|
material.TexNormal = raylib.LoadTexture("dwarf_normal.png") // Load model normal texture
|
||||||
|
material.TexSpecular = raylib.LoadTexture("dwarf_specular.png") // Load model specular texture
|
||||||
|
material.ColDiffuse = raylib.White
|
||||||
|
material.ColAmbient = raylib.NewColor(0, 0, 10, 255)
|
||||||
|
material.ColSpecular = raylib.White
|
||||||
|
material.Glossiness = 50.0
|
||||||
|
|
||||||
|
dwarf.Material = material // Apply material to model
|
||||||
|
|
||||||
|
spotLight := raylib.CreateLight(raylib.LightSpot, raylib.NewVector3(3.0, 5.0, 2.0), raylib.NewColor(255, 255, 255, 255))
|
||||||
|
spotLight.Target = raylib.NewVector3(0.0, 0.0, 0.0)
|
||||||
|
spotLight.Intensity = 2.0
|
||||||
|
spotLight.Diffuse = raylib.NewColor(255, 100, 100, 255)
|
||||||
|
spotLight.ConeAngle = 60.0
|
||||||
|
|
||||||
|
dirLight := raylib.CreateLight(raylib.LightDirectional, raylib.NewVector3(0.0, -3.0, -3.0), raylib.NewColor(255, 255, 255, 255))
|
||||||
|
dirLight.Target = raylib.NewVector3(1.0, -2.0, -2.0)
|
||||||
|
dirLight.Intensity = 2.0
|
||||||
|
dirLight.Diffuse = raylib.NewColor(100, 255, 100, 255)
|
||||||
|
|
||||||
|
pointLight := raylib.CreateLight(raylib.LightPoint, raylib.NewVector3(0.0, 4.0, 5.0), raylib.NewColor(255, 255, 255, 255))
|
||||||
|
pointLight.Intensity = 2.0
|
||||||
|
pointLight.Diffuse = raylib.NewColor(100, 100, 255, 255)
|
||||||
|
pointLight.Radius = 3.0
|
||||||
|
|
||||||
|
// Setup orbital camera
|
||||||
|
raylib.SetCameraMode(camera, raylib.CameraOrbital) // Set an orbital camera mode
|
||||||
|
|
||||||
|
//raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.UpdateCamera(&camera) // Update camera
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.Begin3dMode(camera)
|
||||||
|
|
||||||
|
raylib.DrawModel(dwarf, position, 2.0, raylib.White) // Draw 3d model with texture
|
||||||
|
|
||||||
|
raylib.DrawLight(spotLight) // Draw spot light
|
||||||
|
raylib.DrawLight(dirLight) // Draw directional light
|
||||||
|
raylib.DrawLight(pointLight) // Draw point light
|
||||||
|
|
||||||
|
raylib.DrawGrid(10, 1.0) // Draw a grid
|
||||||
|
|
||||||
|
raylib.End3dMode()
|
||||||
|
|
||||||
|
raylib.DrawText("(c) Dwarf 3D model by David Moreno", screenWidth-200, screenHeight-20, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadMaterial(material) // Unload material and assigned textures
|
||||||
|
raylib.UnloadModel(dwarf) // Unload model
|
||||||
|
|
||||||
|
// Destroy all created lights
|
||||||
|
raylib.DestroyLight(pointLight)
|
||||||
|
raylib.DestroyLight(dirLight)
|
||||||
|
raylib.DestroyLight(spotLight)
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
45
examples/shapes/basic_shapes/main.go
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing")
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("some basic shapes available on raylib", 20, 20, 20, raylib.DarkGray)
|
||||||
|
|
||||||
|
raylib.DrawLine(18, 42, screenWidth-18, 42, raylib.Black)
|
||||||
|
|
||||||
|
raylib.DrawCircle(screenWidth/4, 120, 35, raylib.DarkBlue)
|
||||||
|
raylib.DrawCircleGradient(screenWidth/4, 220, 60, raylib.Green, raylib.SkyBlue)
|
||||||
|
raylib.DrawCircleLines(screenWidth/4, 340, 80, raylib.DarkBlue)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(screenWidth/4*2-60, 100, 120, 60, raylib.Red)
|
||||||
|
raylib.DrawRectangleGradient(screenWidth/4*2-90, 170, 180, 130, raylib.Maroon, raylib.Gold)
|
||||||
|
raylib.DrawRectangleLines(screenWidth/4*2-40, 320, 80, 60, raylib.Orange)
|
||||||
|
|
||||||
|
raylib.DrawTriangle(raylib.NewVector2(float32(screenWidth)/4*3, 80),
|
||||||
|
raylib.NewVector2(float32(screenWidth)/4*3-60, 150),
|
||||||
|
raylib.NewVector2(float32(screenWidth)/4*3+60, 150), raylib.Violet)
|
||||||
|
|
||||||
|
raylib.DrawTriangleLines(raylib.NewVector2(float32(screenWidth)/4*3, 160),
|
||||||
|
raylib.NewVector2(float32(screenWidth)/4*3-20, 230),
|
||||||
|
raylib.NewVector2(float32(screenWidth)/4*3+20, 230), raylib.DarkBlue)
|
||||||
|
|
||||||
|
raylib.DrawPoly(raylib.NewVector2(float32(screenWidth)/4*3, 320), 6, 80, 0, raylib.Brown)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
66
examples/shapes/colors_pallete/main.go
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
raylib.InitWindow(800, 450, "raylib [shapes] example - raylib color palette")
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("raylib color palette", 28, 42, 20, raylib.Black)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(26, 80, 100, 100, raylib.DarkGray)
|
||||||
|
raylib.DrawRectangle(26, 188, 100, 100, raylib.Gray)
|
||||||
|
raylib.DrawRectangle(26, 296, 100, 100, raylib.LightGray)
|
||||||
|
raylib.DrawRectangle(134, 80, 100, 100, raylib.Maroon)
|
||||||
|
raylib.DrawRectangle(134, 188, 100, 100, raylib.Red)
|
||||||
|
raylib.DrawRectangle(134, 296, 100, 100, raylib.Pink)
|
||||||
|
raylib.DrawRectangle(242, 80, 100, 100, raylib.Orange)
|
||||||
|
raylib.DrawRectangle(242, 188, 100, 100, raylib.Gold)
|
||||||
|
raylib.DrawRectangle(242, 296, 100, 100, raylib.Yellow)
|
||||||
|
raylib.DrawRectangle(350, 80, 100, 100, raylib.DarkGreen)
|
||||||
|
raylib.DrawRectangle(350, 188, 100, 100, raylib.Lime)
|
||||||
|
raylib.DrawRectangle(350, 296, 100, 100, raylib.Green)
|
||||||
|
raylib.DrawRectangle(458, 80, 100, 100, raylib.DarkBlue)
|
||||||
|
raylib.DrawRectangle(458, 188, 100, 100, raylib.Blue)
|
||||||
|
raylib.DrawRectangle(458, 296, 100, 100, raylib.SkyBlue)
|
||||||
|
raylib.DrawRectangle(566, 80, 100, 100, raylib.DarkPurple)
|
||||||
|
raylib.DrawRectangle(566, 188, 100, 100, raylib.Violet)
|
||||||
|
raylib.DrawRectangle(566, 296, 100, 100, raylib.Purple)
|
||||||
|
raylib.DrawRectangle(674, 80, 100, 100, raylib.DarkBrown)
|
||||||
|
raylib.DrawRectangle(674, 188, 100, 100, raylib.Brown)
|
||||||
|
raylib.DrawRectangle(674, 296, 100, 100, raylib.Beige)
|
||||||
|
|
||||||
|
raylib.DrawText("DARKGRAY", 65, 166, 10, raylib.Black)
|
||||||
|
raylib.DrawText("GRAY", 93, 274, 10, raylib.Black)
|
||||||
|
raylib.DrawText("LIGHTGRAY", 61, 382, 10, raylib.Black)
|
||||||
|
raylib.DrawText("MAROON", 186, 166, 10, raylib.Black)
|
||||||
|
raylib.DrawText("RED", 208, 274, 10, raylib.Black)
|
||||||
|
raylib.DrawText("PINK", 204, 382, 10, raylib.Black)
|
||||||
|
raylib.DrawText("ORANGE", 295, 166, 10, raylib.Black)
|
||||||
|
raylib.DrawText("GOLD", 310, 274, 10, raylib.Black)
|
||||||
|
raylib.DrawText("YELLOW", 300, 382, 10, raylib.Black)
|
||||||
|
raylib.DrawText("DARKGREEN", 382, 166, 10, raylib.Black)
|
||||||
|
raylib.DrawText("LIME", 420, 274, 10, raylib.Black)
|
||||||
|
raylib.DrawText("GREEN", 410, 382, 10, raylib.Black)
|
||||||
|
raylib.DrawText("DARKBLUE", 498, 166, 10, raylib.Black)
|
||||||
|
raylib.DrawText("BLUE", 526, 274, 10, raylib.Black)
|
||||||
|
raylib.DrawText("SKYBLUE", 505, 382, 10, raylib.Black)
|
||||||
|
raylib.DrawText("DARKPURPLE", 592, 166, 10, raylib.Black)
|
||||||
|
raylib.DrawText("VIOLET", 621, 274, 10, raylib.Black)
|
||||||
|
raylib.DrawText("PURPLE", 620, 382, 10, raylib.Black)
|
||||||
|
raylib.DrawText("DARKBROWN", 705, 166, 10, raylib.Black)
|
||||||
|
raylib.DrawText("BROWN", 733, 274, 10, raylib.Black)
|
||||||
|
raylib.DrawText("BEIGE", 737, 382, 10, raylib.Black)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
29
examples/shapes/logo_raylib/main.go
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes")
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(screenWidth/2-128, screenHeight/2-128, 256, 256, raylib.Black)
|
||||||
|
raylib.DrawRectangle(screenWidth/2-112, screenHeight/2-112, 224, 224, raylib.RayWhite)
|
||||||
|
raylib.DrawText("raylib", screenWidth/2-44, screenHeight/2+48, 50, raylib.Black)
|
||||||
|
|
||||||
|
raylib.DrawText("this is NOT a texture!", 350, 370, 10, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
124
examples/shapes/logo_raylib_anim/main.go
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation")
|
||||||
|
|
||||||
|
logoPositionX := screenWidth/2 - 128
|
||||||
|
logoPositionY := screenHeight/2 - 128
|
||||||
|
|
||||||
|
framesCounter := 0
|
||||||
|
lettersCount := int32(0)
|
||||||
|
|
||||||
|
topSideRecWidth := int32(16)
|
||||||
|
leftSideRecHeight := int32(16)
|
||||||
|
|
||||||
|
bottomSideRecWidth := int32(16)
|
||||||
|
rightSideRecHeight := int32(16)
|
||||||
|
|
||||||
|
state := 0 // Tracking animation states (State Machine)
|
||||||
|
alpha := float32(1.0) // Useful for fading
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
if state == 0 { // State 0: Small box blinking
|
||||||
|
framesCounter++
|
||||||
|
|
||||||
|
if framesCounter == 120 {
|
||||||
|
state = 1
|
||||||
|
framesCounter = 0 // Reset counter... will be used later...
|
||||||
|
}
|
||||||
|
} else if state == 1 { // State 1: Top and left bars growing
|
||||||
|
topSideRecWidth += 4
|
||||||
|
leftSideRecHeight += 4
|
||||||
|
|
||||||
|
if topSideRecWidth == 256 {
|
||||||
|
state = 2
|
||||||
|
}
|
||||||
|
} else if state == 2 { // State 2: Bottom and right bars growing
|
||||||
|
bottomSideRecWidth += 4
|
||||||
|
rightSideRecHeight += 4
|
||||||
|
|
||||||
|
if bottomSideRecWidth == 256 {
|
||||||
|
state = 3
|
||||||
|
}
|
||||||
|
} else if state == 3 { // State 3: Letters appearing (one by one)
|
||||||
|
framesCounter++
|
||||||
|
|
||||||
|
if framesCounter%12 == 0 { // Every 12 frames, one more letter!
|
||||||
|
lettersCount++
|
||||||
|
framesCounter = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if lettersCount >= 6 { // When all letters have appeared, just fade out everything
|
||||||
|
alpha -= 0.02
|
||||||
|
|
||||||
|
if alpha <= 0.0 {
|
||||||
|
alpha = 0.0
|
||||||
|
state = 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if state == 4 { // State 4: Reset and Replay
|
||||||
|
if raylib.IsKeyPressed(raylib.KeyR) {
|
||||||
|
framesCounter = 0
|
||||||
|
lettersCount = 0
|
||||||
|
|
||||||
|
topSideRecWidth = 16
|
||||||
|
leftSideRecHeight = 16
|
||||||
|
|
||||||
|
bottomSideRecWidth = 16
|
||||||
|
rightSideRecHeight = 16
|
||||||
|
|
||||||
|
alpha = 1.0
|
||||||
|
state = 0 // Return to State 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
if state == 0 {
|
||||||
|
if (framesCounter/15)%2 == 0 {
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY, 16, 16, raylib.Black)
|
||||||
|
}
|
||||||
|
} else if state == 1 {
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, raylib.Black)
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, raylib.Black)
|
||||||
|
} else if state == 2 {
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, raylib.Black)
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, raylib.Black)
|
||||||
|
|
||||||
|
raylib.DrawRectangle(logoPositionX+240, logoPositionY, 16, rightSideRecHeight, raylib.Black)
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY+240, bottomSideRecWidth, 16, raylib.Black)
|
||||||
|
} else if state == 3 {
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, raylib.Fade(raylib.Black, alpha))
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY+16, 16, leftSideRecHeight-32, raylib.Fade(raylib.Black, alpha))
|
||||||
|
|
||||||
|
raylib.DrawRectangle(logoPositionX+240, logoPositionY+16, 16, rightSideRecHeight-32, raylib.Fade(raylib.Black, alpha))
|
||||||
|
raylib.DrawRectangle(logoPositionX, logoPositionY+240, bottomSideRecWidth, 16, raylib.Fade(raylib.Black, alpha))
|
||||||
|
|
||||||
|
raylib.DrawRectangle(screenWidth/2-112, screenHeight/2-112, 224, 224, raylib.Fade(raylib.RayWhite, alpha))
|
||||||
|
|
||||||
|
text := "raylib"
|
||||||
|
length := int32(len(text))
|
||||||
|
if lettersCount > length {
|
||||||
|
lettersCount = length
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.DrawText(text[0:lettersCount], screenWidth/2-44, screenHeight/2+48, 50, raylib.Fade(raylib.Black, alpha))
|
||||||
|
} else if state == 4 {
|
||||||
|
raylib.DrawText("[R] REPLAY", 340, 200, 20, raylib.Gray)
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
99
examples/text/bmfont_ttf/fonts/bmfont.fnt
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
info face="Arial Black" size=-32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2 outline=0
|
||||||
|
common lineHeight=45 base=35 scaleW=512 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4
|
||||||
|
page id=0 file="bmfont.png"
|
||||||
|
chars count=95
|
||||||
|
char id=32 x=423 y=141 width=3 height=45 xoffset=-1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=33 x=323 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=34 x=123 y=141 width=16 height=45 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=15
|
||||||
|
char id=35 x=221 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=36 x=244 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=37 x=70 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15
|
||||||
|
char id=38 x=390 y=0 width=25 height=45 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=15
|
||||||
|
char id=39 x=378 y=141 width=8 height=45 xoffset=1 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=40 x=222 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=41 x=499 y=94 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=42 x=497 y=47 width=13 height=45 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=15
|
||||||
|
char id=43 x=394 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=44 x=367 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=45 x=261 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=46 x=356 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=47 x=248 y=141 width=11 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=48 x=382 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=49 x=496 y=0 width=14 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=50 x=134 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=51 x=359 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=52 x=313 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=53 x=336 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=54 x=178 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=55 x=478 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=56 x=290 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=57 x=90 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=58 x=345 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=59 x=334 y=141 width=9 height=45 xoffset=1 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=60 x=0 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=61 x=21 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=62 x=310 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=63 x=352 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=64 x=279 y=0 width=26 height=45 xoffset=-1 yoffset=0 xadvance=24 page=0 chnl=15
|
||||||
|
char id=65 x=193 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=66 x=150 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=67 x=444 y=0 width=24 height=45 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=68 x=174 y=47 width=22 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=69 x=156 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=70 x=63 y=141 width=18 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=71 x=417 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=72 x=125 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=73 x=388 y=141 width=8 height=45 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=74 x=200 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=75 x=251 y=0 width=26 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=76 x=373 y=94 width=19 height=45 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=77 x=134 y=0 width=28 height=45 xoffset=1 yoffset=0 xadvance=30 page=0 chnl=15
|
||||||
|
char id=78 x=100 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=79 x=363 y=0 width=25 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=80 x=112 y=94 width=20 height=45 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=81 x=335 y=0 width=26 height=45 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=82 x=470 y=0 width=24 height=45 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=83 x=75 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=84 x=50 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=85 x=25 y=47 width=23 height=45 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=15
|
||||||
|
char id=86 x=307 y=0 width=26 height=45 xoffset=0 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=87 x=0 y=0 width=34 height=45 xoffset=-1 yoffset=0 xadvance=32 page=0 chnl=15
|
||||||
|
char id=88 x=222 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=89 x=164 y=0 width=27 height=45 xoffset=-1 yoffset=0 xadvance=25 page=0 chnl=15
|
||||||
|
char id=90 x=0 y=47 width=23 height=45 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=15
|
||||||
|
char id=91 x=274 y=141 width=11 height=45 xoffset=1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=92 x=300 y=141 width=10 height=45 xoffset=-1 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=93 x=287 y=141 width=11 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=94 x=457 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=95 x=103 y=141 width=18 height=45 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=15
|
||||||
|
char id=96 x=312 y=141 width=9 height=45 xoffset=0 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=97 x=474 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=98 x=68 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=99 x=267 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=100 x=46 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=101 x=198 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=102 x=141 y=141 width=15 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=103 x=222 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=104 x=415 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=105 x=398 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=106 x=235 y=141 width=11 height=45 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=107 x=405 y=47 width=21 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=108 x=407 y=141 width=7 height=45 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=15
|
||||||
|
char id=109 x=102 y=0 width=30 height=45 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=15
|
||||||
|
char id=110 x=331 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=111 x=428 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=112 x=266 y=94 width=20 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=113 x=288 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=114 x=158 y=141 width=15 height=45 xoffset=1 yoffset=0 xadvance=14 page=0 chnl=15
|
||||||
|
char id=115 x=244 y=94 width=20 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=116 x=175 y=141 width=14 height=45 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=15
|
||||||
|
char id=117 x=436 y=94 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=118 x=451 y=47 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=119 x=36 y=0 width=32 height=45 xoffset=-1 yoffset=0 xadvance=30 page=0 chnl=15
|
||||||
|
char id=120 x=0 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=15
|
||||||
|
char id=121 x=23 y=94 width=21 height=45 xoffset=0 yoffset=0 xadvance=20 page=0 chnl=15
|
||||||
|
char id=122 x=83 y=141 width=18 height=45 xoffset=0 yoffset=0 xadvance=18 page=0 chnl=15
|
||||||
|
char id=123 x=191 y=141 width=14 height=45 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=124 x=416 y=141 width=5 height=45 xoffset=2 yoffset=0 xadvance=9 page=0 chnl=15
|
||||||
|
char id=125 x=207 y=141 width=13 height=45 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15
|
||||||
|
char id=126 x=42 y=141 width=19 height=45 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=15
|
BIN
examples/text/bmfont_ttf/fonts/bmfont.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
examples/text/bmfont_ttf/fonts/pixantiqua.ttf
Normal file
42
examples/text/bmfont_ttf/main.go
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont and ttf sprite fonts loading")
|
||||||
|
|
||||||
|
msgBm := "THIS IS AN AngelCode SPRITE FONT"
|
||||||
|
msgTtf := "THIS SPRITE FONT has been GENERATED from a TTF"
|
||||||
|
|
||||||
|
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
fontBm := raylib.LoadSpriteFont("fonts/bmfont.fnt") // BMFont (AngelCode)
|
||||||
|
fontTtf := raylib.LoadSpriteFont("fonts/pixantiqua.ttf") // TTF font
|
||||||
|
|
||||||
|
fontPosition := raylib.Vector2{}
|
||||||
|
|
||||||
|
fontPosition.X = float32(screenWidth)/2 - raylib.MeasureTextEx(fontBm, msgBm, float32(fontBm.Size), 0).X/2
|
||||||
|
fontPosition.Y = float32(screenHeight)/2 - float32(fontBm.Size)/2 - 80
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawTextEx(fontBm, msgBm, fontPosition, float32(fontBm.Size), 0, raylib.Maroon)
|
||||||
|
raylib.DrawTextEx(fontTtf, msgTtf, raylib.NewVector2(75.0, 240.0), float32(fontTtf.Size)*0.8, 2, raylib.Lime)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadSpriteFont(fontBm) // AngelCode SpriteFont unloading
|
||||||
|
raylib.UnloadSpriteFont(fontTtf) // TTF SpriteFont unloading
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|
188
examples/text/bmfont_unordered/fonts/pixantiqua.fnt
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
info face="PixAntiqua" size=32 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=2,2,2,2 spacing=2,2 outline=0
|
||||||
|
common lineHeight=32 base=27 scaleW=512 scaleH=512 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4
|
||||||
|
page id=0 file="pixantiqua_0.png"
|
||||||
|
chars count=184
|
||||||
|
char id=32 x=9 y=304 width=7 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=33 x=391 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=34 x=240 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=35 x=468 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=36 x=152 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=37 x=176 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=38 x=303 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=39 x=495 y=266 width=8 height=36 xoffset=-3 yoffset=-2 xadvance=5 page=0 chnl=15
|
||||||
|
char id=40 x=256 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=199 x=432 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=200 x=126 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=201 x=147 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=202 x=288 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=203 x=189 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=204 x=468 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=205 x=486 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=206 x=0 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=207 x=72 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=208 x=329 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=209 x=277 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=210 x=182 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=211 x=26 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=41 x=272 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=42 x=288 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=43 x=414 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=44 x=378 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=45 x=414 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=46 x=443 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=47 x=392 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=48 x=485 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=49 x=450 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=50 x=21 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=51 x=42 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=59 x=456 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=60 x=168 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=61 x=309 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=62 x=336 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=63 x=315 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=64 x=364 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=65 x=390 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=66 x=120 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=67 x=144 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=68 x=168 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=69 x=294 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=52 x=488 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=53 x=63 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=54 x=24 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=55 x=48 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=56 x=72 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=57 x=96 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=58 x=404 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=70 x=252 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=71 x=192 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=72 x=78 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=78 x=78 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=79 x=355 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=80 x=264 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=81 x=381 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=82 x=288 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=83 x=312 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=91 x=144 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=92 x=108 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=93 x=304 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=94 x=34 y=0 width=32 height=36 xoffset=-3 yoffset=-2 xadvance=29 page=0 chnl=15
|
||||||
|
char id=95 x=231 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=96 x=442 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=97 x=408 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=98 x=432 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=99 x=210 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=84 x=336 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=85 x=360 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=86 x=0 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=87 x=68 y=0 width=30 height=36 xoffset=-3 yoffset=-2 xadvance=27 page=0 chnl=15
|
||||||
|
char id=88 x=26 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=89 x=384 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=90 x=84 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=100 x=456 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=101 x=480 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=102 x=54 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=103 x=0 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=104 x=24 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=105 x=469 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=106 x=18 y=266 width=16 height=36 xoffset=-8 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=107 x=48 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=108 x=417 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=109 x=161 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=110 x=72 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=111 x=96 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=117 x=192 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=118 x=216 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=119 x=248 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=120 x=240 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=121 x=264 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=122 x=288 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=123 x=432 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=124 x=365 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=125 x=378 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=126 x=393 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=127 x=132 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=160 x=0 y=304 width=7 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=161 x=352 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=162 x=351 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=163 x=336 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=165 x=360 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=167 x=384 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=169 x=433 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=170 x=224 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=171 x=105 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=172 x=0 y=0 width=32 height=36 xoffset=-3 yoffset=-2 xadvance=29 page=0 chnl=15
|
||||||
|
char id=173 x=494 y=38 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=174 x=52 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=175 x=52 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=176 x=126 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=177 x=435 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=178 x=320 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=179 x=336 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=181 x=459 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=112 x=120 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=113 x=144 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=114 x=396 y=228 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=115 x=168 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=116 x=36 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=182 x=408 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=183 x=498 y=190 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=185 x=192 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=186 x=208 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=187 x=477 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=191 x=456 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=192 x=407 y=0 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=193 x=234 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=194 x=416 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=195 x=156 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=196 x=130 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=197 x=104 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=198 x=190 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=212 x=0 y=76 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=213 x=338 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=214 x=312 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=215 x=357 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=216 x=286 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=217 x=456 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=218 x=480 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=219 x=0 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=220 x=24 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=221 x=48 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=222 x=260 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=223 x=72 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=224 x=96 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=225 x=120 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=226 x=144 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=227 x=168 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=228 x=192 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=229 x=216 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=230 x=219 y=0 width=27 height=36 xoffset=-3 yoffset=-2 xadvance=24 page=0 chnl=15
|
||||||
|
char id=231 x=372 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=73 x=90 y=266 width=16 height=36 xoffset=-3 yoffset=-2 xadvance=13 page=0 chnl=15
|
||||||
|
char id=74 x=216 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=75 x=240 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=76 x=273 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=77 x=100 y=0 width=30 height=36 xoffset=-3 yoffset=-2 xadvance=27 page=0 chnl=15
|
||||||
|
char id=232 x=312 y=152 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=233 x=240 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=234 x=264 y=190 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=235 x=104 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=236 x=430 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=237 x=482 y=266 width=11 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=238 x=160 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=11 page=0 chnl=15
|
||||||
|
char id=239 x=176 y=266 width=14 height=36 xoffset=-3 yoffset=-2 xadvance=8 page=0 chnl=15
|
||||||
|
char id=240 x=128 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=241 x=200 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=242 x=224 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=243 x=248 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=244 x=272 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=245 x=296 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=246 x=320 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=247 x=330 y=190 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=248 x=208 y=38 width=24 height=36 xoffset=-3 yoffset=-2 xadvance=21 page=0 chnl=15
|
||||||
|
char id=249 x=344 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=250 x=368 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=251 x=416 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=252 x=440 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=253 x=464 y=76 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
||||||
|
char id=254 x=0 y=228 width=19 height=36 xoffset=-3 yoffset=-2 xadvance=16 page=0 chnl=15
|
||||||
|
char id=255 x=0 y=114 width=22 height=36 xoffset=-3 yoffset=-2 xadvance=19 page=0 chnl=15
|
BIN
examples/text/bmfont_unordered/fonts/pixantiqua_0.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
41
examples/text/bmfont_unordered/main.go
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/gen2brain/raylib-go/raylib"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
screenWidth := int32(800)
|
||||||
|
screenHeight := int32(450)
|
||||||
|
|
||||||
|
raylib.InitWindow(screenWidth, screenHeight, "raylib [text] example - bmfont unordered loading and drawing")
|
||||||
|
|
||||||
|
// NOTE: Using chars outside the [32..127] limits!
|
||||||
|
// NOTE: If a character is not found in the font, it just renders a space
|
||||||
|
msg := "ASCII extended characters:\n¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆ\nÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæ\nçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
|
||||||
|
|
||||||
|
// NOTE: Loaded font has an unordered list of characters (chars in the range 32..255)
|
||||||
|
font := raylib.LoadSpriteFont("fonts/pixantiqua.fnt") // BMFont (AngelCode)
|
||||||
|
|
||||||
|
raylib.SetTargetFPS(60)
|
||||||
|
|
||||||
|
for !raylib.WindowShouldClose() {
|
||||||
|
raylib.BeginDrawing()
|
||||||
|
|
||||||
|
raylib.ClearBackground(raylib.RayWhite)
|
||||||
|
|
||||||
|
raylib.DrawText("Font name: PixAntiqua", 40, 50, 20, raylib.Gray)
|
||||||
|
raylib.DrawText(fmt.Sprintf("Font base size: %d", font.Size), 40, 80, 20, raylib.Gray)
|
||||||
|
raylib.DrawText(fmt.Sprintf("Font chars number: %d", font.NumChars), 40, 110, 20, raylib.Gray)
|
||||||
|
|
||||||
|
raylib.DrawTextEx(font, msg, raylib.NewVector2(40, 180), float32(font.Size), 0, raylib.Maroon)
|
||||||
|
|
||||||
|
raylib.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
raylib.UnloadSpriteFont(font) // AngelCode SpriteFont unloading
|
||||||
|
|
||||||
|
raylib.CloseWindow()
|
||||||
|
}
|