1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: remove the need for [console] for gg or ui programs on windows (#15912)

This commit is contained in:
Larpon
2022-09-29 14:02:50 +02:00
committed by GitHub
parent 79a473f8ec
commit 816e9319d7
21 changed files with 28 additions and 37 deletions

View File

@ -147,8 +147,6 @@ fn on_init(mut app App) {
app.resize()
}
// is needed for easier diagnostics on windows
[console]
fn main() {
println("Press 'q' to quit.")
mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))

View File

@ -93,8 +93,6 @@ fn (mut app App) resize() {
app.ui.height = size.height
}
// is needed for easier diagnostics on windows
[console]
fn main() {
mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
$if android {

View File

@ -222,7 +222,6 @@ fn graphics_keydown(code gg.KeyCode, mod gg.Modifier, mut state AppState) {
}
}
[console]
fn main() {
mut state := &AppState{}
state.gg = gg.new_context(

View File

@ -403,8 +403,6 @@ fn my_event_manager(mut ev gg.Event, mut app App) {
* Main
*
******************************************************************************/
// is needed for easier diagnostics on windows
[console]
fn main() {
// App init
mut app := &App{

View File

@ -577,7 +577,6 @@ fn my_event_manager(mut ev gg.Event, mut app App) {
* Main
*
******************************************************************************/
[console] // is needed for easier diagnostics on windows
fn main() {
// App init
mut app := &App{

View File

@ -392,7 +392,6 @@ fn my_event_manager(mut ev gg.Event, mut app App) {
/******************************************************************************
* Main
******************************************************************************/
[console] // is needed for easier diagnostics on windows
fn main() {
// App init
mut app := &App{

View File

@ -586,7 +586,6 @@ fn my_event_manager(mut ev gg.Event, mut app App) {
/******************************************************************************
* Main
******************************************************************************/
[console] // is needed for easier diagnostics on windows
fn main() {
// App init
mut app := &App{

View File

@ -475,7 +475,6 @@ fn my_event_manager(mut ev gg.Event, mut app App) {
/******************************************************************************
* Main
******************************************************************************/
[console] // is needed for easier diagnostics on windows
fn main(){
// App init
mut app := &App{

View File

@ -265,8 +265,6 @@ fn my_event_manager(mut ev gg.Event, mut app App) {
/******************************************************************************
* Main
******************************************************************************/
// is needed for easier diagnostics on windows
[console]
fn main() {
/*
obj.tst()

View File

@ -13,7 +13,6 @@ mut:
font_normal int
}
[console]
fn main() {
mut color_action := gfx.ColorAttachmentAction{
action: .clear

View File

@ -61,7 +61,6 @@ mut:
inited bool
}
[console]
fn main() {
mut color_action := gfx.ColorAttachmentAction{
action: .clear

View File

@ -116,7 +116,6 @@ fn my_event_manager(mut ev gg.Event, mut app App_data) {
}
}
[console]
fn main() {
mut app := &App_data{
gg: 0

View File

@ -444,7 +444,7 @@ fn frame(mut app App) {
if app.show_info_flag == true && app.scale > 1 {
mut bw := f32(0.25)
mut bh := f32(0.25 / app.img_ratio)
// manage the rotations
if rotation & 1 == 1 {
bw,bh = bh,bw
@ -454,11 +454,11 @@ fn frame(mut app App) {
if rotation & 1 == 1 {
bx,by = by,bx
}
bh_old1 := bh
bh *= ratio
by += (bh_old1 - bh)
// draw the zoom icon
sgl.begin_quads()
r := int(u32(rotation) << 1)
@ -467,17 +467,17 @@ fn frame(mut app App) {
sgl.v2f_t2f_c3b(bx + bw, by + bh, uv[(4 + r) & 7] , uv[(5 + r) & 7], c[0], c[1], c[2])
sgl.v2f_t2f_c3b(bx , by + bh, uv[(6 + r) & 7] , uv[(7 + r) & 7], c[0], c[1], c[2])
sgl.end()
// draw the zoom rectangle
sgl.disable_texture()
bw_old := bw
bh_old := bh
bw /= app.scale
bh /= app.scale
bx += (bw_old - bw) / 2 - (tr_x / 8) / app.scale
by += (bh_old - bh) / 2 - ((tr_y / 8) / app.scale) * ratio
c = [u8(255),255,0]! // yellow
sgl.begin_line_strip()
sgl.v2f_c3b(bx , by , c[0], c[1], c[2])
@ -517,7 +517,7 @@ fn frame(mut app App) {
scale_str := "${app.scale:.2}"
text := "${num}/${of_num} [${app.img_w},${app.img_h}]=>[${x_screen},${y_screen}] ${app.item_list.lst[app.item_list.item_index].name} scale: ${scale_str} rotation: ${rotation_angle}"
//text := "${num}/${of_num}"
draw_text(mut app, text, 10, 10, 20)
draw_text(mut app, text, 10, 10, 20)
unsafe{
text.free()
}
@ -761,8 +761,6 @@ fn load_and_show(file_list []string, mut app App) {
* Main
*
******************************************************************************/
// is needed for easier diagnostics on windows
[console]
fn main() {
// mut font_path := os.resource_abs_path(os.join_path('../assets/fonts/', 'RobotoMono-Regular.ttf'))
font_name := 'RobotoMono-Regular.ttf'