gg: remove obsolete usages of `use_ortho: true`

pull/10559/head
Delyan Angelov 2021-06-24 11:07:09 +03:00
parent cc91d9bee3
commit f18265e6a8
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
19 changed files with 17 additions and 36 deletions

View File

@ -109,7 +109,6 @@ fn main() {
height: app.ui.height
window_title: 'Fireworks!'
bg_color: gx.black
use_ortho: true
user_data: app
frame_fn: on_frame
event_fn: on_event

View File

@ -185,7 +185,6 @@ fn main() {
bg_color: gx.white
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'flappylearning-v'
frame_fn: frame

View File

@ -48,7 +48,6 @@ fn main() {
user_data: &app
width: screen_width
height: screen_height
use_ortho: true
create_window: true
resizable: false
window_title: 'v life (with gg, gx)'

View File

@ -74,7 +74,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'Empty window'
user_data: app

View File

@ -23,7 +23,6 @@ fn main() {
bg_color: gx.white
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'Rectangles'
frame_fn: frame

View File

@ -30,7 +30,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'Counter'
user_data: app

View File

@ -37,7 +37,6 @@ fn main() {
width: window_width
height: window_height
font_size: 20
use_ortho: true
user_data: game
window_title: 'Hot code reloading demo'
create_window: true

View File

@ -23,7 +23,6 @@ fn main() {
width: size
height: size
font_size: 20
use_ortho: true
user_data: context
window_title: 'Graph builder'
create_window: true

View File

@ -211,7 +211,6 @@ fn main() {
user_data: &app
width: canvas_size
height: top_height + canvas_size
use_ortho: true
create_window: true
resizable: false
window_title: 'snek'

View File

@ -418,7 +418,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: '3D Cube Demo'
user_data: app

View File

@ -612,7 +612,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: '3D Cube Demo'
user_data: app

View File

@ -423,7 +423,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: '3D Ray Marching Cube'
user_data: app

View File

@ -619,7 +619,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: '3D Dual shader Cube - click and rotate with the mouse'
user_data: app

View File

@ -506,7 +506,6 @@ fn main(){
app.gg = gg.new_context({
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'Instancing Cube'
user_data: app

View File

@ -323,7 +323,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'V Wavefront OBJ viewer - Use the mouse wheel to zoom'
user_data: app
@ -336,4 +335,4 @@ fn main() {
app.ticks = time.ticks()
app.gg.run()
}
}

View File

@ -44,7 +44,6 @@ fn main() {
bg_color: gx.rgb(50, 50, 50)
width: 1024
height: 400
use_ortho: true
create_window: true
window_title: 'ByteBeat Music'
frame_fn: graphics_frame

View File

@ -167,7 +167,6 @@ fn main() {
bg_color: gx.white
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'V Tetris' //
user_data: game

View File

@ -123,7 +123,6 @@ fn main() {
app.gg = gg.new_context(
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'Test TTF module'
user_data: app

View File

@ -1,7 +1,7 @@
# TTF font utility
## introduction
This module is designed to perform two main task
- Load the font file
- Load the font file
- Render text using a TTF font
The render system can be single or multiple, for example it is possible to have a bitmap
@ -18,7 +18,7 @@ ttf_font.buf = os.read_bytes("arial.ttf") or { panic(err) }
ttf_font.init()
```
*Note: the font must be passed to the `TTF_file` as RAM buffer.*
At this point the font "arial" is loaded and parsed and if it is a valid TTF font it is
At this point the font "arial" is loaded and parsed and if it is a valid TTF font it is
ready for the rendering.
We can get some quick info on the font as string using the `get_info_string` function:
@ -53,7 +53,7 @@ In this modue it is possible to have different renders running at the same time.
At the present time all the rendering are made on the CPU, sokol is used only to draw the
rendered text to the screen.
Let's start with a simple snippet of code:
```v ignore
```v oksyntax
import os
import x.ttf
[console]
@ -70,7 +70,7 @@ This simple code load a TTF font and display its basic informations.
### draw_text
The draw text function draw simple strings without indentation or other imagination tasks.
At this point we can render a simple text:
```v ignore
```v oksyntax
import os
import x.ttf
@ -81,7 +81,7 @@ fn main(){
ttf_font.init()
// print font info
println(ttf_font.get_info_string())
bmp_width := 200
bmp_heigth := 64
bmp_layers := 4 // number of planes for an RGBA buffer
@ -122,7 +122,7 @@ Using the low level rendering you need to manage all the amenities like allocate
memory and other tasks like calc the character dimensions.
You can specify the style for the text rendering in the `BitMap` struct::
```v ignore
```v
enum Style {
outline
outline_aliased
@ -134,7 +134,7 @@ Use this level only if you want achieve particular result on text rendering.
### draw_text_block
Draw text block draw a justified and indented block of multiline text in the bitmap.
```v ignore
```v oksyntax
import os
import x.ttf
@ -145,7 +145,7 @@ fn main(){
ttf_font.init()
// print font info
println(ttf_font.get_info_string())
bmp_width := 200
bmp_heigth := 200
bmp_layers := 4 // number of planes for an RGBA buffer
@ -186,7 +186,7 @@ But Vwill prevail for sure, V is the way!!
```
This is the low level render that draw text block on the bitmap.
A text block is defined from a `Text_block` struct:
```v ignore
```v
struct Text_block {
x int // x postion of the left high corner
y int // y postion of the left high corner
@ -196,7 +196,7 @@ struct Text_block {
}
```
and use the following bitmap fields:
```v ignore
```v oksyntax
style Style = .filled // default syle
align Text_align = .left // default text align
justify bool // justify text flag, default deactivated
@ -211,7 +211,7 @@ the text to the screen.
It is mor esimpel to use in a `gg app` that the raw bitmap render.
Each single text rendered need its own reder to be declared, after you can modify it.
Here a simple example of the usage:
```v ignore
```v oksyntax
import gg
import gx
import sokol.sapp
@ -235,7 +235,7 @@ pub mut:
sg_img C.sg_image
init_flag bool
frame_c int
tf []ttf.TTF_File
ttf_render []ttf.TTF_render_Sokol
}
@ -246,7 +246,7 @@ fn my_init(mut app App_data) {
fn draw_frame(mut app &App_data) {
cframe_txt := "Current Frame: $app.frame_c"
app.gg.begin()
sgl.defaults()
@ -267,7 +267,7 @@ fn draw_frame(mut app &App_data) {
}
[console]
fn main(){
fn main(){
mut app := &App_data{
gg: 0
}
@ -275,7 +275,6 @@ fn main(){
app.gg = gg.new_context({
width: win_width
height: win_height
use_ortho: true // This is needed for 2D drawing
create_window: true
window_title: 'Test TTF module'
user_data: app
@ -293,7 +292,7 @@ fn main(){
println(tf.get_info_string())
app.tf << tf
}
// TTF render 0 Frame counter
app.ttf_render << &ttf.TTF_render_Sokol {
bmp: &ttf.BitMap{
@ -304,7 +303,7 @@ fn main(){
//style: .raw
}
}
app.gg.run()
}
```